Reset wxPGEditor singleton instance pointers in dtors. This is useful if wxPropertyGrid is being accessed from an external main loop.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65666 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli 2010-09-28 18:59:41 +00:00
parent 490e22fdd0
commit 1e005ad1fd
3 changed files with 33 additions and 11 deletions

View File

@ -240,12 +240,12 @@ WX_PG_IMPLEMENT_INTERNAL_EDITOR_CLASS(SpinCtrl,
wxPGEditor)
// Trivial destructor.
// Destructor. It is useful to reset the global pointer in it.
wxPGSpinCtrlEditor::~wxPGSpinCtrlEditor()
{
wxPG_EDITOR(SpinCtrl) = NULL;
}
// Create controls and initialize event handling.
wxPGWindowList wxPGSpinCtrlEditor::CreateControls( wxPropertyGrid* propgrid, wxPGProperty* property,
const wxPoint& pos, const wxSize& sz ) const

View File

@ -507,7 +507,12 @@ void wxPGTextCtrlEditor::OnFocus( wxPGProperty* property,
wxPGTextCtrlEditor_OnFocus(property, tc);
}
wxPGTextCtrlEditor::~wxPGTextCtrlEditor() { }
wxPGTextCtrlEditor::~wxPGTextCtrlEditor()
{
// Reset the global pointer. Useful when wxPropertyGrid is accessed
// from an external main loop.
wxPG_EDITOR(TextCtrl) = NULL;
}
// -----------------------------------------------------------------------
@ -1216,7 +1221,10 @@ bool wxPGChoiceEditor::CanContainCustomImage() const
}
wxPGChoiceEditor::~wxPGChoiceEditor() { }
wxPGChoiceEditor::~wxPGChoiceEditor()
{
wxPG_EDITOR(Choice) = NULL;
}
// -----------------------------------------------------------------------
@ -1300,7 +1308,11 @@ void wxPGComboBoxEditor::OnFocus( wxPGProperty* property,
}
wxPGComboBoxEditor::~wxPGComboBoxEditor() { }
wxPGComboBoxEditor::~wxPGComboBoxEditor()
{
wxPG_EDITOR(ComboBox) = NULL;
}
// -----------------------------------------------------------------------
@ -1352,8 +1364,10 @@ wxPGWindowList wxPGChoiceAndButtonEditor::CreateControls( wxPropertyGrid* propGr
}
wxPGChoiceAndButtonEditor::~wxPGChoiceAndButtonEditor() { }
wxPGChoiceAndButtonEditor::~wxPGChoiceAndButtonEditor()
{
wxPG_EDITOR(ChoiceAndButton) = NULL;
}
// -----------------------------------------------------------------------
// wxPGTextCtrlAndButtonEditor
@ -1377,8 +1391,10 @@ wxPGWindowList wxPGTextCtrlAndButtonEditor::CreateControls( wxPropertyGrid* prop
}
wxPGTextCtrlAndButtonEditor::~wxPGTextCtrlAndButtonEditor() { }
wxPGTextCtrlAndButtonEditor::~wxPGTextCtrlAndButtonEditor()
{
wxPG_EDITOR(TextCtrlAndButton) = NULL;
}
// -----------------------------------------------------------------------
// wxPGCheckBoxEditor
@ -1708,8 +1724,10 @@ void wxPGCheckBoxEditor::SetValueToUnspecified( wxPGProperty* WXUNUSED(property)
}
wxPGCheckBoxEditor::~wxPGCheckBoxEditor() { }
wxPGCheckBoxEditor::~wxPGCheckBoxEditor()
{
wxPG_EDITOR(CheckBox) = NULL;
}
#endif // wxPG_INCLUDE_CHECKBOX

View File

@ -235,6 +235,10 @@ wxPGGlobalVarsClass::~wxPGGlobalVarsClass()
delete ((wxPGEditor*)vt_it->second);
}
// Make sure the global pointers have been reset
wxASSERT(wxPG_EDITOR(TextCtrl) == NULL);
wxASSERT(wxPG_EDITOR(ChoiceAndButton) == NULL);
delete wxPGProperty::sm_wxPG_LABEL;
}