Open v-ein opened 7 months ago
There needs to be a map<mvAppItemType, stack<mvThemeComponent>>
or stack<mvTheme>
to support nesting themes like this. It looks like the current code creates linked lists between mvThemeComponent
instead, which can break noisily when you nest an item with a theme inside another item with the same theme.
However, theme components with the same mvAppItemType
as the item holding the theme don't get put into this linked list, just every component of a different type. So you need the dpg.group()
s in that example for it to corrupt.
Another example:
If you click on Dolor a bit, it will acquire contagious green text from the asymptomatic Lorem Ipsum
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)
dpg.add_theme_color(dpg.mvThemeCol_Text, (0, 255, 0), category=dpg.mvThemeCat_Core)
with dpg.menu(label="Lorem"):
dpg.bind_item_theme(dpg.last_item(), header_theme)
with dpg.menu(label="Ipsum"):
dpg.bind_item_theme(dpg.last_item(), header_theme)
with dpg.collapsing_header(label="Dolor", default_open=True):
pass
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:
Expected behavior
No heap corruption.
Screenshots/Video
Here's the error message I got in Visual Studio after clicking "Debug":
Standalone, minimal, complete and verifiable example