]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/persist/window.h
compilation fix after last commit
[wxWidgets.git] / include / wx / persist / window.h
index 01ff6489d13157119cfc3eebefd3836f1ecb71c3..84c27ba35c3561bacf367b326b1f3d5e87ac09de 100644 (file)
@@ -34,6 +34,7 @@ public:
     wxPersistentWindowBase(wxWindow *win)
         : wxPersistentObject(win)
     {
+#if wxEVENTS_COMPATIBILITY_2_8
         win->Connect
              (
                 wxEVT_DESTROY,
@@ -42,6 +43,9 @@ public:
                 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
@@ -60,8 +64,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);