hoffstadt / DearPyGui

Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies
https://dearpygui.readthedocs.io/en/latest/
MIT License
12.62k stars 669 forks source link

Windows Access Violation while plotting non-empty X and empty Y arrays #2304

Open xtotdam opened 3 months ago

xtotdam commented 3 months ago

Version of Dear PyGui

Version: 1.10.1 Operating System: Win 10

My Issue/Question

If I create / update a series plot while X array is not empty and Y is, then an Access violation error occurs:

Windows fatal exception: access violation

Thread 0x000037ec (most recent call first):
  <no Python frame>

Current thread 0x00002bc4 (most recent call first):
  File "C:\Mambaforge\envs\irge\Lib\site-packages\dearpygui\dearpygui.py", line 8908 in render_dearpygui_frame
  File "C:\Dropbox\Projects\irge\dpg_experiments\vio.py", line 26 in <module>

This reproduces with add_bar_series, add_line_series etc

Expected behavior

No crash

Standalone, minimal, complete and verifiable example

import dearpygui.dearpygui as dpg

# this allows to see violation info
import faulthandler
faulthandler.enable()

dpg.create_context()
dpg.create_viewport()
dpg.setup_dearpygui()

with dpg.window(label="Access violation", height=550, width=350):
    with dpg.plot(height=500, width=300):
        dpg.add_plot_axis(dpg.mvXAxis)
        dpg.add_plot_axis(dpg.mvYAxis)
        dpg.add_line_series(x=[1], y=[], parent=dpg.last_item(), tag='plot:rates') # Violation

dpg.show_viewport()
while dpg.is_dearpygui_running():
    # dpg.configure_item('plot:rates', x=[], y=[]) # OK
    dpg.configure_item('plot:rates', x=[1], y=[]) # Violation
    # dpg.configure_item('plot:rates', x=[], y=[1]) # OK
    dpg.render_dearpygui_frame()

dpg.destroy_context()

PS

Thanks for the awesome lib!