Work around wxPropertyGrid state loss on modules reinitialization
Don't reallocate wxPGGlobalVars if it's somehow already allocated when wxPGGlobalVarsClassManager::OnInit() is called: this is not supposed to happen but it does when wxPython redoes the modules initialization after loading another module. See #23165.
This commit is contained in:
parent
9b4ec1963f
commit
edbd9094e8
@ -145,7 +145,15 @@ class wxPGGlobalVarsClassManager : public wxModule
|
||||
wxDECLARE_DYNAMIC_CLASS(wxPGGlobalVarsClassManager);
|
||||
public:
|
||||
wxPGGlobalVarsClassManager() {}
|
||||
virtual bool OnInit() wxOVERRIDE { wxPGGlobalVars = new wxPGGlobalVarsClass(); return true; }
|
||||
virtual bool OnInit() wxOVERRIDE
|
||||
{
|
||||
// This shouldn't happen, but we can actually be more called more than
|
||||
// once, e.g. wxPython does it, see #23165, and in this case we
|
||||
// shouldn't lose the current state.
|
||||
if ( !wxPGGlobalVars )
|
||||
wxPGGlobalVars = new wxPGGlobalVarsClass();
|
||||
return true;
|
||||
}
|
||||
virtual void OnExit() wxOVERRIDE { wxDELETE(wxPGGlobalVars); }
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user