wxPersistentWindowBase(wxWindow *win)
: wxPersistentObject(win)
{
+#if wxEVENTS_COMPATIBILITY_2_8
win->Connect
(
wxEVT_DESTROY,
NULL,
this
);
+#else // !wxEVENTS_COMPATIBILITY_2_8
+ win->Bind(wxEVT_DESTROY, &wxPersistentWindowBase::HandleDestroy, this);
+#endif // wxEVENTS_COMPATIBILITY_2_8/!wxEVENTS_COMPATIBILITY_2_8
}
virtual wxString GetName() const
{
event.Skip();
- // this will delete this object itself
- wxPersistenceManager::Get().SaveAndUnregister(GetWindow());
+ // only react to the destruction of this object itself, not of any of
+ // its children
+ if ( event.GetEventObject() == GetObject() )
+ {
+ // this will delete this object itself
+ wxPersistenceManager::Get().SaveAndUnregister(GetWindow());
+ }
}
- DECLARE_NO_COPY_CLASS(wxPersistentWindowBase)
+ wxDECLARE_NO_COPY_CLASS(wxPersistentWindowBase);
};
template <class T>