DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

DearPyGui Demo crashes

Open helloginov opened this issue 1 year ago • 1 comments

Version: 1.11.1 Operating System: Windows 11

As a beginner in DearPyGui, I was trying demo "application" promoted by official docs (section 1.3 Demo). Carefully studying and clicking all that is possible, I found the way to crash the program. I use VS Code and Anaconda

Steps to reproduce the behavior:

  1. Go to DearPyGui official tutorial
  2. Copy and run the code in section 1.3 Demo: import dearpygui.dearpygui as dpg import dearpygui.demo as demo

dpg.create_context() dpg.create_viewport(title='Custom Title', width=600, height=600)

demo.show_demo()

dpg.setup_dearpygui() dpg.show_viewport() dpg.start_dearpygui() dpg.destroy_context()

  1. The application must be successfully opened. Click menu "Plots" --> tab "Custom" --> "Custom Series". Find the single legend at the shown plot and right click in.

  2. See error: The Kernel crashed while executing code in the current cell or a previous cell. Please review the code in the cell(s) to identify a possible cause of the failure. Click here for more info. View Jupyter log for further details.

Expected behavior: everything except crashing the program

helloginov avatar Sep 16 '24 10:09 helloginov

Good catch!

The issue is caused by the ambiguous use of children items by different series:

  • Some (probably all) series put all their children into the legend popup menu
  • Custom series use slot 1 items to create a tooltip, slot 2 items to render its contents, and still use children from all slots to populate the legend popup.

There are multiple problems here:

  1. Slot 1 items are used both for the popup and for the tooltip - it should probably use them for tooltip only if tooltip=True is specified.
  2. Slot 2 items must not be rendered within the popup because they constitute the actual series data and not the popup menu.
  3. The crash occurs because custom_series attempts to render slot 2 items in the popup with the default drawlist, which is nullptr; however, the drawing primitives absolutely require a valid drawlist pointer. With drawlist == nullptr, they dereference a null pointer. This also applies to other series, all of which attempt to render slot 2 items in the popup window too; however, the drawing primitives probably can't be added to other series due to the "acceptable parents" restriction.

v-ein avatar Sep 16 '24 19:09 v-ein