hoffstadt / hoffstadt/DearPyGui

Node deletion with multiple links connected to same output throws an "Item not found" error.

Open
#2,442 1 comment 1 reaction 0 assignees View on GitHub
state: pending type: bug
Dominant language
C++
Stars
15.6k
Forks
783
PR merge metrics
No merged PRs in 30d

Description

## Version of Dear PyGui

Version: 2.0.0
Operating System: macOS 15.1.1

## My Issue/Question

Deleting a node with multiple links connected to a single of its outputs leads to "Item not found" error on some link ids.

Error message:
```
Exception:
Error: [1005]
Command: delete_item
Item: 0
Label: Not found
Item Type: Unknown
Message: Item not found: 40
```

## To Reproduce

Create two nodes with multiple inputs / outputs.
Connect single output of first node to multiple inputs of second node.
Delete first node.
=> Item not found error.

## Expected behavior
Should delete all links cleanly.

## Standalone, minimal, complete and verifiable example

```python
import dearpygui.dearpygui as dpg
dpg.create_context()

def link_callback(sender, links):
dpg.add_node_link(links[0], links[1], parent=sender)

def delink_callback(sender, link):
dpg.delete_item(link)

def delNodes(sender):
lst = dpg.get_selected_nodes("node_edit")
for node in lst:
dpg.delete_item(node)

with dpg.window(tag="window", label="Del node bug", width=400, height=400):
dpg.add_menu_item(label="Delete", callback=delNodes)
with dpg.node_editor(parent="window", tag="node_edit", callback=link_callback, delink_callback=delink_callback):

with dpg.node(tag=2000, label="Node 1"):
with dpg.node_attribute(tag=100, label="s1", attribute_type=dpg.mvNode_Attr_Input):
dpg.add_text("intextonly")
with dpg.node_attribute(tag=200, label="s2", attribute_type=dpg.mvNode_Attr_Output):
dpg.add_text("outtextonly")
with dpg.node_attribute(label="s2", attribute_type=dpg.mvNode_Attr_Output):
dpg.add_text("outtextonly")
with dpg.node_attribute(tag=300, label="s3", attribute_type=dpg.mvNode_Attr_Output):
dpg.add_text("outextonly")

with dpg.node(tag=3000, label="Node 2"):
with dpg.node_attribute(tag=400, label="s1", attribute_type=dpg.mvNode_Attr_Input):
dpg.add_text("intextonly")
with dpg.node_attribute(tag=500, label="s2", attribute_type=dpg.mvNode_Attr_Input):
dpg.add_text("intextonly")
with dpg.node_attribute(label="s2", attribute_type=dpg.mvNode_Attr_Input):
dpg.add_text("intextonly")
with dpg.node_attribute(label="s2", attribute_type=dpg.mvNode_Attr_Input):
dpg.add_text("intextonly")
with dpg.node_attribute(tag=600, label="s3", attribute_type=dpg.mvNode_Attr_Output):
dpg.add_text("outtextonly")

dpg.create_viewport(title='Del node bug', width=800, height=600)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.set_primary_window("window", True)
dpg.start_dearpygui()
dpg.destroy_context()
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.