]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/persist/window.h
another missing WXDLLIMPEXP to fix DLL build
[wxWidgets.git] / include / wx / persist / window.h
index 692e143a139e3f6942322c7e849fdfffd8a148b7..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,11 +64,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 <class T>