DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

Application crashes when custom_series being deleted from a callback

Open sedenka opened this issue 3 years ago • 1 comments

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:

  1. Click on the first button (application crashes)
  2. Click on the second button (application crashes)
  3. 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()

sedenka avatar Aug 19 '22 17:08 sedenka

experienced the same issue

AnnaSasDev avatar Aug 25 '22 21:08 AnnaSasDev

Fixed in next release.

hoffstadt avatar Oct 22 '22 03:10 hoffstadt

Seems like the program still crashing when clear the plot with custom_series

qizheng-1998 avatar Oct 24 '22 19:10 qizheng-1998