X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0fa541e8706f74887efeba9e475eae618873da2a..a8519f6507f7b4389c0fe7dbae4ebd63120d5dd0:/include/wx/persist/window.h?ds=sidebyside diff --git a/include/wx/persist/window.h b/include/wx/persist/window.h index 692e143a13..1cb6d01257 100644 --- a/include/wx/persist/window.h +++ b/include/wx/persist/window.h @@ -60,11 +60,16 @@ private: { 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