Polls

Default Game Speed

Log in to vote!

Latest Posts

Topic: How to use UI::Dropdown

Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 504
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2019-12-03, 13:08

In two of my development branches, I am having trouble with UI::Dropdown.

In scenario-editor, I am adapting some WUI functionality for use in the editor. To set settings for productionsites there, the workers tab in ProductionSiteWindow gets a Dropdown. When opening the window in the editor, this works fine, but opening a TrainingsiteWindow (which inherits from ProductionSiteWindow) results in ASan crashing with heap-use-after-free.

In expedition-cfg, the port´s expedition tab gets a dropdown which works well. When the expedition is ready while the window is still open, the tab´s closing causes a heap-use-after-free.

In both cases, the backtrace points to

ui_basic/dropdown.cc:143
(many lines of boost::signals2::...)
ui_basic/panel.cc:272

Apparently, the dropdown hooks into all toplevel windows to layout properly, and the lambda function doesn´t seem to notice that the dropdown was already deleted if only a tab and not the whole window closes. Is this a bug in dropdown code, or is there some easy way to work around this?


Top Quote