DearPyGui Demo crashes
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:
- Go to DearPyGui official tutorial
- Copy and run the code in section 1.3 Demo:
import dearpygui.dearpygui as dpgimport 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()
-
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.
-
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
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:
- Slot 1 items are used both for the popup and for the tooltip - it should probably use them for tooltip only if
tooltip=Trueis specified. - Slot 2 items must not be rendered within the popup because they constitute the actual series data and not the popup menu.
- The crash occurs because
custom_seriesattempts to render slot 2 items in the popup with the default drawlist, which isnullptr; however, the drawing primitives absolutely require a valid drawlist pointer. Withdrawlist == 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.