ensure objects are in the correct thread when loading
Since we load in a separate thread, when the QObject based objects are instantiated, they're created with affinity to that separate thread. Now we specifically ensure they are moved to the main thread after their creation.
This commit is contained in:
+4
-4
@@ -41,8 +41,8 @@ void NodeGraph::AddNode(Node *node)
|
||||
|
||||
node->setParent(this);
|
||||
|
||||
connect(node, SIGNAL(EdgeAdded(NodeEdgePtr)), this, SIGNAL(EdgeAdded(NodeEdgePtr)));
|
||||
connect(node, SIGNAL(EdgeRemoved(NodeEdgePtr)), this, SIGNAL(EdgeRemoved(NodeEdgePtr)));
|
||||
connect(node, &Node::EdgeAdded, this, &NodeGraph::EdgeAdded);
|
||||
connect(node, &Node::EdgeRemoved, this, &NodeGraph::EdgeRemoved);
|
||||
|
||||
node_children_.append(node);
|
||||
|
||||
@@ -62,8 +62,8 @@ void NodeGraph::TakeNode(Node *node, QObject* new_parent)
|
||||
|
||||
node->DisconnectAll();
|
||||
|
||||
disconnect(node, SIGNAL(EdgeAdded(NodeEdgePtr)), this, SIGNAL(EdgeAdded(NodeEdgePtr)));
|
||||
disconnect(node, SIGNAL(EdgeRemoved(NodeEdgePtr)), this, SIGNAL(EdgeRemoved(NodeEdgePtr)));
|
||||
disconnect(node, &Node::EdgeAdded, this, &NodeGraph::EdgeAdded);
|
||||
disconnect(node, &Node::EdgeRemoved, this, &NodeGraph::EdgeRemoved);
|
||||
|
||||
node->setParent(new_parent);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user