X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c0c133e13b36a923c65f94499554e432bc3a0daa..a8519f6507f7b4389c0fe7dbae4ebd63120d5dd0:/include/wx/persist/window.h diff --git a/include/wx/persist/window.h b/include/wx/persist/window.h index 01ff6489d1..1cb6d01257 100644 --- a/include/wx/persist/window.h +++ b/include/wx/persist/window.h @@ -60,8 +60,13 @@ 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()); + } } wxDECLARE_NO_COPY_CLASS(wxPersistentWindowBase);