nodeview: prevent infinite loops

Fixes #1531
This commit is contained in:
itsmattkc
2021-04-23 11:52:40 +10:00
parent 4864656cf5
commit ed542f0842
+6 -1
View File
@@ -407,11 +407,16 @@ void NodeView::mouseMoveEvent(QMouseEvent *event)
// Find if the cursor is currently inside an item
NodeViewItem* item_at_cursor = dynamic_cast<NodeViewItem*>(itemAt(event->pos()));
// Filter out connecting to self1
// Filter out connecting to self
if (item_at_cursor == create_edge_src_) {
item_at_cursor = nullptr;
}
// Filter out connecting to a node that connects to us
if (item_at_cursor && item_at_cursor->GetNode()->OutputsTo(create_edge_src_->GetNode(), true)) {
item_at_cursor = nullptr;
}
// If the item has changed
if (item_at_cursor != create_edge_dst_) {
// If we had a destination active, disconnect from it since the item has changed