From ed542f08427f7695c69fab289c1e4d7aa1d6da27 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 23 Apr 2021 11:52:40 +1000 Subject: [PATCH] nodeview: prevent infinite loops Fixes #1531 --- app/widget/nodeview/nodeview.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/widget/nodeview/nodeview.cpp b/app/widget/nodeview/nodeview.cpp index f307a3201..a6f6c3f9f 100644 --- a/app/widget/nodeview/nodeview.cpp +++ b/app/widget/nodeview/nodeview.cpp @@ -407,11 +407,16 @@ void NodeView::mouseMoveEvent(QMouseEvent *event) // Find if the cursor is currently inside an item NodeViewItem* item_at_cursor = dynamic_cast(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