Initialize array for wxPropertyGrid alphabetic mode only once

Array holding items to use in non-categoric mode should be created and
initially populated only once.

Closes #24145.
This commit is contained in:
Artur Wieczorek 2023-12-22 22:46:54 +01:00
parent 99434fa005
commit 6dd129049f
2 changed files with 8 additions and 7 deletions

View file

@ -813,7 +813,6 @@ protected:
bool m_dontCenterSplitter;
private:
// Only inits arrays, doesn't migrate things or such.
void InitNonCatMode();
};

View file

@ -219,12 +219,14 @@ wxPropertyGridPageState::~wxPropertyGridPageState()
void wxPropertyGridPageState::InitNonCatMode()
{
if ( !m_abcArray )
{
m_abcArray = new wxPGRootProperty(wxS("<Root_NonCat>"));
m_abcArray->SetParentState(this);
m_abcArray->SetFlag(wxPG_PROP_CHILDREN_ARE_COPIES);
}
// Initialize and populate array holding properties in alphabetic (non-categoric)
// mode only once.
if (m_abcArray)
return;
m_abcArray = new wxPGRootProperty(wxS("<Root_NonCat>"));
m_abcArray->SetParentState(this);
m_abcArray->SetFlag(wxPG_PROP_CHILDREN_ARE_COPIES);
// Must be called when state::m_properties still points to regularArray.
wxPGProperty* oldProperties = m_properties;