From: Stefan Csomor <csomor@advancedconcepts.ch>
Date: Sat, 11 May 2002 06:50:06 +0000 (+0000)
Subject: toplevel native window disposal in deferred delete clas
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/118f012e37be5cba952b0148fa9601573930138f

toplevel native window disposal in deferred delete clas


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp
index a9acd84e2c..b197af73a7 100644
--- a/src/mac/carbon/toplevel.cpp
+++ b/src/mac/carbon/toplevel.cpp
@@ -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 ) ;
diff --git a/src/mac/toplevel.cpp b/src/mac/toplevel.cpp
index a9acd84e2c..b197af73a7 100644
--- a/src/mac/toplevel.cpp
+++ b/src/mac/toplevel.cpp
@@ -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 ) ;