wxPendingDelete.Append( new wxMacDeferredWindowDeleter( (WindowRef) m_macWindow ) ) ;
     }
  
- #if TARGET_CARBON
+#if TARGET_CARBON
     if ( m_macEventHandler )
     {
         ::RemoveEventHandler((EventHandlerRef) m_macEventHandler);
 #endif   
     wxRemoveMacWindowAssociation( this ) ;
 
-    wxTopLevelWindows.DeleteObject(this);
-
     if ( wxModelessWindows.Find(this) )
         wxModelessWindows.DeleteObject(this);
 
-    // If this is the last top-level window, exit.
-    if ( wxTheApp && (wxTopLevelWindows.Number() == 0) )
-    {
-        wxTheApp->SetTopWindow(NULL);
-
-        if ( wxTheApp->GetExitOnFrameDelete() )
-        {
-          wxTheApp->ExitMainLoop() ;        
-        }
-    }
     DisposeRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ;
 }
 
 
         wxPendingDelete.Append( new wxMacDeferredWindowDeleter( (WindowRef) m_macWindow ) ) ;
     }
  
- #if TARGET_CARBON
+#if TARGET_CARBON
     if ( m_macEventHandler )
     {
         ::RemoveEventHandler((EventHandlerRef) m_macEventHandler);
 #endif   
     wxRemoveMacWindowAssociation( this ) ;
 
-    wxTopLevelWindows.DeleteObject(this);
-
     if ( wxModelessWindows.Find(this) )
         wxModelessWindows.DeleteObject(this);
 
-    // If this is the last top-level window, exit.
-    if ( wxTheApp && (wxTopLevelWindows.Number() == 0) )
-    {
-        wxTheApp->SetTopWindow(NULL);
-
-        if ( wxTheApp->GetExitOnFrameDelete() )
-        {
-          wxTheApp->ExitMainLoop() ;        
-        }
-    }
     DisposeRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ;
 }