DearPyGui
DearPyGui copied to clipboard
Application crashes when custom_series being deleted from a callback
Version of Dear PyGui
Version: 1.6.2 Operating System: Windows 10
My Issue/Question
The code below crashes when I am trying to delete custom_series from a callback using parent item or tag. The code crashes only when the custom_series is visible (if you use dpg.add_custom_series(..., show=False), the application will not crash).
To Reproduce
Steps to reproduce the behavior:
- Click on the first button (application crashes)
- Click on the second button (application crashes)
- Check the command line output and the code (immediately deleting works as expected)
Expected behavior
Removal of the item from a callback should be possible without the crash.
Standalone, minimal, complete and verifiable example
import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.create_viewport(width=300, height=200)
dpg.setup_dearpygui()
with dpg.window(label="Example Window", tag="Primary"):
dpg.add_button(label="delete custom_series using parent", callback=lambda: dpg.delete_item("win", children_only=True))
dpg.add_button(label="delete custom_series using tag", callback=lambda: dpg.delete_item("tricky_custom_series"))
with dpg.child_window(tag="win"):
with dpg.plot(width=-1, height=-1):
dpg.add_plot_axis(dpg.mvXAxis)
with dpg.plot_axis(dpg.mvYAxis) as yaxis:
dpg.add_custom_series([], [], 2, tag="tricky_custom_series")
print(f"Before delete_item(): {dpg.get_item_children(yaxis, 1)}")
dpg.delete_item("tricky_custom_series")
print(f"After delete_item(): {dpg.get_item_children(yaxis, 1)}")
dpg.add_custom_series([], [], 2, tag="tricky_custom_series")
print(f"After add_custom_series(): {dpg.get_item_children(yaxis, 1)}")
dpg.show_viewport()
dpg.set_primary_window("Primary", True)
dpg.start_dearpygui()
dpg.destroy_context()
experienced the same issue
Fixed in next release.
Seems like the program still crashing when clear the plot with custom_series