Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding a handler to node_link leads to a segfault #2197

Closed
v-ein opened this issue Oct 4, 2023 · 1 comment · Fixed by #2224
Closed

Binding a handler to node_link leads to a segfault #2197

v-ein opened this issue Oct 4, 2023 · 1 comment · Fixed by #2224
Labels
state: pending not addressed yet type: bug bug

Comments

@v-ein
Copy link
Contributor

v-ein commented Oct 4, 2023

Version of Dear PyGui

Version: 1.9.1
Operating System: Windows 10

My Issue/Question

Whenever a handler is bound to node_link, DPG segfaults. See also #2196 for details on handler applicability.

Note: the only handler supported by a node link is item_hover_handler, which cannot be bound until #2196 is fixed. That is, this issue cannot be tested until #2196 is fixed.

To Reproduce

Steps to reproduce the behavior:

  1. Run the example below.
  2. It segfaults right away.

Expected behavior

When a supported handler is bound to node_link (see also #2196), there must be no segfaults, and the handler must run whenever there are appropriate conditions for that.

Screenshots/Video

None.

Standalone, minimal, complete and verifiable example

import traceback
import dearpygui.dearpygui as dpg


dpg.create_context()
with dpg.window(label="Example Window") as main:
    with dpg.node_editor() as editor:
        with dpg.node(label="Node 1", pos=(20, 20)):
            with dpg.node_attribute(label="Attr", attribute_type=dpg.mvNode_Attr_Output) as attr1:
                dpg.add_text("Text")

        with dpg.node(label="Node 2", pos=(220, 20)):
            with dpg.node_attribute(label="Attr", attribute_type=dpg.mvNode_Attr_Input) as attr2:
                dpg.add_text("Text")

        node_link = dpg.add_node_link(attr1, attr2, parent=editor)

        try:
            with dpg.item_handler_registry() as handlers:
                dpg.add_item_hover_handler(callback=lambda: print("Node link hovered"))
            dpg.bind_item_handler_registry(node_link, handlers)
        except Exception as e:
            print("Failed to bind - please make sure #2196 has been fixed.")
            print(traceback.format_exc())


dpg.create_viewport()
dpg.setup_dearpygui()

dpg.set_primary_window(main, True)

dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
@v-ein v-ein added state: pending not addressed yet type: bug bug labels Oct 4, 2023
@v-ein
Copy link
Contributor Author

v-ein commented Oct 4, 2023

Caused by a null pointer. Got a fix for it and going to eventually open a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: pending not addressed yet type: bug bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant