Fix life cycle of dynamically allocated wxPGProperty label

Label should be allocated in wxPGGlobalVarsClass ctor and disposed in dtor.
Closes #23237.
This commit is contained in:
Artur Wieczorek 2023-02-08 18:01:31 +01:00
parent be10ce0713
commit 620e02c568
2 changed files with 5 additions and 1 deletions

View file

@ -529,7 +529,7 @@ wxPGChoiceEntry& wxPGChoicesData::Insert(int index,
wxIMPLEMENT_ABSTRACT_CLASS(wxPGProperty, wxObject); wxIMPLEMENT_ABSTRACT_CLASS(wxPGProperty, wxObject);
#if WXWIN_COMPATIBILITY_3_2 #if WXWIN_COMPATIBILITY_3_2
wxString* wxPGProperty::sm_wxPG_LABEL = new wxString("@!"); wxString* wxPGProperty::sm_wxPG_LABEL = nullptr;
#endif // WXWIN_COMPATIBILITY_3_2 #endif // WXWIN_COMPATIBILITY_3_2
const wxString wxPGProperty::sm_labelItem("@!"); const wxString wxPGProperty::sm_labelItem("@!");

View file

@ -204,6 +204,10 @@ wxPGGlobalVarsClass::wxPGGlobalVarsClass()
, m_extraStyle(0) , m_extraStyle(0)
, m_warnings(0) , m_warnings(0)
{ {
#if WXWIN_COMPATIBILITY_3_2
wxPGProperty::sm_wxPG_LABEL = new wxString("@!");
#endif // WXWIN_COMPATIBILITY_3_2
/* TRANSLATORS: Name of Boolean false value */ /* TRANSLATORS: Name of Boolean false value */
m_boolChoices.Add(_("False")); m_boolChoices.Add(_("False"));
/* TRANSLATORS: Name of Boolean true value */ /* TRANSLATORS: Name of Boolean true value */