diff options
author | Jim Albamont <jim.albamont@kdab.com> | 2019-04-04 13:12:30 -0500 |
---|---|---|
committer | James Turner <james.turner@kdab.com> | 2019-04-08 08:07:49 +0000 |
commit | 985a61921fbcb893b89b8dde6eeaab5cf8c5dc1c (patch) | |
tree | 803306dfa93f67e1bd047ec09c93b0770cead878 /examples/examples.pro | |
parent | bf2c2e9bb2dd0b13cb2cb6728de0c2421fbafbb7 (diff) |
Fix backend node creation order using an initialization queue
Backend nodes should always be created from the top-most parent down
ensuring that every parent is created before its children. The original
way of creating backend nodes by calling _q_postConstructorInit
in a deferred manner from the QNode constructor breaks this because
backend node creation happens in the order that the nodes on the
front-end were created. This was often incorrect when reparenting
newly created nodes.
Fix by creating a queue of nodes needing a _q_postConstructorInit call
and only adding nodes to the queue if one of their ancestors is not
already in the queue. This ensures that _q_postConstructorInit is only
called for the top-most node in any subtree. This behavior exactly
matches the creation behavior when building a subtree and reparenting
it to a node with a backend.
Doing silly things like creating a node with a parent that has a backend
then immediately reparenting is now safe. After this patch, it should
be safe to assume that backend nodes can always find their backend
parent.
Adding only the top-most nodes to the queue and processing the entire
queue at one time also ensures that all creation events get sent in
the same batch. This fixes the problem of having backend nodes referring
to other backend nodes that haven't been created yet.
Task-number: QTBUG-74106
Task-number: QTBUG-73905
Change-Id: Idcf38d6c3164f6be4394a3b25554547414061059
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'examples/examples.pro')
0 files changed, 0 insertions, 0 deletions