X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/af1a6227cc5b17afeded61658fb7a7dc3e862d8a..bb5b7285057aa71bd9d86aad6effb00dbfcd1f85:/src/x11/window.cpp diff --git a/src/x11/window.cpp b/src/x11/window.cpp index dcd3dffb80..f10becfa7f 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -45,10 +45,10 @@ #include "wx/listbox.h" #include "wx/scrolwin.h" #include "wx/layout.h" + #include "wx/menuitem.h" + #include "wx/module.h" #endif -#include "wx/module.h" -#include "wx/menuitem.h" #include "wx/fontutil.h" #include "wx/univ/renderer.h" @@ -357,10 +357,13 @@ wxWindowX11::~wxWindowX11() } // Destroy the window - Window xwindow = (Window) m_mainWindow; - wxDeleteWindowFromTable( xwindow ); - XDestroyWindow( wxGlobalDisplay(), xwindow ); - m_mainWindow = NULL; + if ( m_mainWindow ) + { + Window xwindow = (Window) m_mainWindow; + wxDeleteWindowFromTable( xwindow ); + XDestroyWindow( wxGlobalDisplay(), xwindow ); + m_mainWindow = NULL; + } } // --------------------------------------------------------------------------- @@ -1694,8 +1697,14 @@ int wxNoOptimize::ms_count = 0; class wxWinModule : public wxModule { public: - bool OnInit(); - void OnExit(); + wxWinModule() + { + // we must be cleaned up before the display is closed + AddDependency(wxClassInfo::FindClass(_T("wxX11DisplayModule"))); + } + + virtual bool OnInit(); + virtual void OnExit(); private: DECLARE_DYNAMIC_CLASS(wxWinModule)