1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Is pulldown component broken by the Sep patch? CTD issue.

Discussion in 'Mod Creation Help' started by Zur13, Oct 13, 2019.

  1. Zur13

    Zur13 Chieftain

    Joined:
    Nov 7, 2018
    Messages:
    25
    Gender:
    Male
    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:
    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: Oct 14, 2019

Share This Page