hoffstadt / hoffstadt/DearPyGui
Component-specific themes corrupt the heap
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
## Version of Dear PyGui
Version: 1.10.1
Operating System: Windows 10
## My Issue/Question
This only happes with a particular use case, see the example below. There's a theme that contains a component for `mvCollapsingHeader`, and that theme gets bound to groups that follow a certain flow of widgets. With that particular widget tree, the heap within Python gets corrupted, and the program crashes on closing. Sometimes there are visible side effects, e.g. colors or widget visibility may be affected. It depends on a particular run.
## To Reproduce
Steps to reproduce the behavior:
1. Run the example below.
2. Close the window. See it crash.
## Expected behavior
No heap corruption.
## Screenshots/Video

Here's the error message I got in Visual Studio after clicking "Debug":
```
Unhandled exception at 0x000000007764F3E2 (ntdll.dll) in python.exe: 0xC0000374: A heap has been corrupted (parameters: 0x00000000776C8430). occurred
```
## Standalone, minimal, complete and verifiable example
```python
import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.create_viewport(title="Test", width=600, height=600)
dpg.setup_dearpygui()
dpg.show_viewport()
with dpg.window(width=200, height=150):
with dpg.theme() as header_theme:
with dpg.theme_component(dpg.mvCollapsingHeader):
dpg.add_theme_style(dpg.mvStyleVar_FramePadding, 4, 0)
with dpg.collapsing_header(label="Lorem", default_open=True):
with dpg.group():
dpg.bind_item_theme(dpg.last_item(), header_theme)
with dpg.collapsing_header(label="Ipsum", default_open=True):
with dpg.group():
dpg.bind_item_theme(dpg.last_item(), header_theme)
dpg.start_dearpygui()
dpg.destroy_context()
```
Contributor guide
Assessment
This issue has not been assessed yet.