]> git.saurik.com Git - wxWidgets.git/blobdiff - src/dfb/toplevel.cpp
Add entry for 2.8.0.1
[wxWidgets.git] / src / dfb / toplevel.cpp
index 508999102c1741dedf251be2842e5012dde87254..b5dcc161da77a086deecb8685b937c54f01b2e3c 100644 (file)
@@ -138,7 +138,7 @@ bool wxTopLevelWindowDFB::Create(wxWindow *parent,
     desc.width = size.x;
     desc.height = size.y;
     m_dfbwin = layer->CreateWindow(&desc);
-    if ( !layer )
+    if ( !m_dfbwin )
         return false;
 
     // add the new TLW to DFBWindowID->wxTLW map:
@@ -176,22 +176,23 @@ wxTopLevelWindowDFB::~wxTopLevelWindowDFB()
 {
     m_isBeingDeleted = true;
 
-    wxTopLevelWindows.DeleteObject(this);
-
-    if ( wxTheApp->GetTopWindow() == this )
-        wxTheApp->SetTopWindow(NULL);
-
-    if ( wxTopLevelWindows.empty() && wxTheApp->GetExitOnFrameDelete() )
-    {
-        wxTheApp->ExitMainLoop();
-    }
+    // destroy all children before we destroy the underlying DirectFB window,
+    // so that if any of them does something with the TLW, it will still work:
+    DestroyChildren();
 
+    // it's safe to delete the underlying DirectFB window now:
     wxDELETE(m_toPaint);
 
+    if ( !m_dfbwin )
+        return;
+
     // remove the TLW from DFBWindowID->wxTLW map:
     DFBWindowID winid;
     if ( m_dfbwin->GetID(&winid) )
         gs_dfbWindowsMap.erase(winid);
+
+    m_dfbwin->Destroy();
+    m_dfbwin.Reset();
 }
 
 // ----------------------------------------------------------------------------
@@ -527,6 +528,10 @@ void wxTopLevelWindowDFB::HandleDFBWindowEvent(const wxDFBWindowEvent& event_)
             wxFAIL_MSG( _T("invalid event type") );
             break;
         }
+
+        default:
+            // we're not interested in them here
+            break;
     }
 
     if ( !recipient )