]> git.saurik.com Git - wxWidgets.git/commitdiff
toplevel native window disposal in deferred delete clas
authorStefan Csomor <csomor@advancedconcepts.ch>
Sat, 11 May 2002 06:50:06 +0000 (06:50 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sat, 11 May 2002 06:50:06 +0000 (06:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/toplevel.cpp
src/mac/toplevel.cpp

index a9acd84e2cd0acc0de9874549c89bf909319e4bc..b197af73a748f105c2ac0ee4d4332bf1e5920635 100644 (file)
@@ -112,6 +112,21 @@ void wxTopLevelWindowMac::Init()
     m_macWindow = NULL ;
 }
 
+class wxMacDeferredWindowDeleter : public wxObject
+{
+public :
+    wxMacDeferredWindowDeleter( WindowRef windowRef ) 
+    { 
+        m_macWindow = windowRef ; 
+    }
+    virtual ~wxMacDeferredWindowDeleter() 
+    { 
+        UMADisposeWindow( (WindowRef) m_macWindow ) ; 
+    }
+ protected :
+    WindowRef m_macWindow ;
+} ;
+
 bool wxTopLevelWindowMac::Create(wxWindow *parent,
                                  wxWindowID id,
                                  const wxString& title,
@@ -142,7 +157,7 @@ wxTopLevelWindowMac::~wxTopLevelWindowMac()
     if ( m_macWindow )
     {
         wxToolTip::NotifyWindowDelete(m_macWindow) ;
-        UMADisposeWindow( (WindowRef) m_macWindow ) ;
+        wxPendingDelete.Append( new wxMacDeferredWindowDeleter( (WindowRef) m_macWindow ) ) ;
     }
     
     wxRemoveMacWindowAssociation( this ) ;
index a9acd84e2cd0acc0de9874549c89bf909319e4bc..b197af73a748f105c2ac0ee4d4332bf1e5920635 100644 (file)
@@ -112,6 +112,21 @@ void wxTopLevelWindowMac::Init()
     m_macWindow = NULL ;
 }
 
+class wxMacDeferredWindowDeleter : public wxObject
+{
+public :
+    wxMacDeferredWindowDeleter( WindowRef windowRef ) 
+    { 
+        m_macWindow = windowRef ; 
+    }
+    virtual ~wxMacDeferredWindowDeleter() 
+    { 
+        UMADisposeWindow( (WindowRef) m_macWindow ) ; 
+    }
+ protected :
+    WindowRef m_macWindow ;
+} ;
+
 bool wxTopLevelWindowMac::Create(wxWindow *parent,
                                  wxWindowID id,
                                  const wxString& title,
@@ -142,7 +157,7 @@ wxTopLevelWindowMac::~wxTopLevelWindowMac()
     if ( m_macWindow )
     {
         wxToolTip::NotifyWindowDelete(m_macWindow) ;
-        UMADisposeWindow( (WindowRef) m_macWindow ) ;
+        wxPendingDelete.Append( new wxMacDeferredWindowDeleter( (WindowRef) m_macWindow ) ) ;
     }
     
     wxRemoveMacWindowAssociation( this ) ;