X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/79481be2f8dca35f3c0ae4343ce6f00bddb16305..ce7208d49d5ce2ca1dc0b3b83f14f1d04f29c4bf:/src/mgl/app.cpp?ds=inline diff --git a/src/mgl/app.cpp b/src/mgl/app.cpp index 62207edf46..53c61fad16 100644 --- a/src/mgl/app.cpp +++ b/src/mgl/app.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: app.cpp +// Name: src/mgl/app.cpp // Author: Vaclav Slavik // based on GTK and MSW implementations // Id: $Id$ @@ -7,10 +7,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "app.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -18,17 +14,17 @@ #pragma hdrstop #endif +#include "wx/app.h" #ifndef WX_PRECOMP #include "wx/settings.h" - #include "wx/module.h" #include "wx/frame.h" #include "wx/dialog.h" #include "wx/log.h" #include "wx/intl.h" + #include "wx/module.h" #endif -#include "wx/app.h" #include "wx/evtloop.h" #include "wx/fontutil.h" #include "wx/univ/theme.h" @@ -128,7 +124,7 @@ class wxRootWindow : public wxWindow SetMGLwindow_t(MGL_wmGetRootWindow(g_winMng)); SetBackgroundColour(wxTHEME_COLOUR(DESKTOP)); } - ~wxRootWindow() + virtual ~wxRootWindow() { // we don't want to delete MGL_WM's rootWnd m_wnd = NULL; @@ -306,17 +302,30 @@ bool wxApp::Initialize(int& argc, wxChar **argv) return true; } +// Modules are cleaned up after wxApp::CleanUp(), and some modules may +// require MGL to still be alive, e.g. the stock fonts need the fonts +// manager. So append this module last minute in wxApp::CleanUp() to close +// down MGL after all the other modules have been cleaned up. +// +struct wxMGLFinalCleanup: public wxModule +{ + bool OnInit() { return true; } + + void OnExit() + { + delete wxTheFontsManager; + wxTheFontsManager = (wxFontsManager*) NULL; + + wxDestroyMGL_WM(); + MGL_exit(); + } +}; + void wxApp::CleanUp() { delete gs_rootWindow; wxAppBase::CleanUp(); - // must do this after calling base class CleanUp() - delete wxTheFontsManager; - wxTheFontsManager = (wxFontsManager*) NULL; - - wxDestroyMGL_WM(); - MGL_exit(); + wxModule::RegisterModule(new wxMGLFinalCleanup); } -