Zur13
Chieftain
- Joined
- Nov 7, 2018
- Messages
- 26
So I have a lot of mods with the common issue: when the mod with pulldown (combobox) enabled and used in game after the you try to leave the game (exit to the main menu) the game crash happens.
After a lot of debugging I've isolated the issue to this case:
UI XML component:
The callback function (really does not have any code inside, just a blank function):
If this line uncommented the crash on leaving the game happens after the mod window showed, and if the line is commented there is no crash:
Just to clarify while in the game no errors in logs and nothing bad happens the UI works fine but as soon as you try to exit the game (to the main menu or to the desktop) the crash happens.
Any suggestions on how to fix the issue? I can't redesign UI of so many mods to avoid pulldown components.
Edit: I think I found the problem, this happens only in very special case when you have used ChangeParent() to place your mod component outside of your mod UI context. The crash happens only if the component which was reparented had a callback listener function which had a RegisterSelectionCallback() call inside to register pulldown selection listener.
After a lot of debugging I've isolated the issue to this case:
UI XML component:
HTML:
<PullDown ID="CmePDRoute" Anchor="R,C" Offset="93,0" Size="230,28" Style="PullDownBlue" ToolTip="LOC_CHEAT_MAP_EDITOR_PD_ROUTE_TIP" ScrollThreshold="500" SpaceForScroll="1" AutoFlip="1" />
The callback function (really does not have any code inside, just a blank function):
Code:
function CmePDonSelectionChangedCBRoute( index1, type1, control )
end
function UpdateCBRoute()
-- some code here
local pdNameSuffix2 = "Route";
-- and some code here
Controls["CmePD" .. pdNameSuffix2]:RegisterSelectionCallback( CmePDonSelectionChangedCBRoute );
end
If this line uncommented the crash on leaving the game happens after the mod window showed, and if the line is commented there is no crash:
Code:
Controls["CmePD" .. pdNameSuffix2]:RegisterSelectionCallback( CmePDonSelectionChangedCBRoute );
Just to clarify while in the game no errors in logs and nothing bad happens the UI works fine but as soon as you try to exit the game (to the main menu or to the desktop) the crash happens.
Any suggestions on how to fix the issue? I can't redesign UI of so many mods to avoid pulldown components.
Edit: I think I found the problem, this happens only in very special case when you have used ChangeParent() to place your mod component outside of your mod UI context. The crash happens only if the component which was reparented had a callback listener function which had a RegisterSelectionCallback() call inside to register pulldown selection listener.
Last edited: