From 6ecb1fdd31f4852d4bbaf0b1d9eec88998d8ca65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Thu, 30 Jul 2009 07:09:43 +0000 Subject: [PATCH] Use wxInitializer in wxEntryReal() instead of directly calling wxEntryStart() without refcounting. This makes it possible to write hybrid CLI/GUI wx applications. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61552 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/init.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/common/init.cpp b/src/common/init.cpp index 90afc70ac8..dd91413436 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -113,14 +113,6 @@ private: wxAppConsole *m_app; }; -// another tiny class which simply exists to ensure that wxEntryCleanup is -// always called -class wxCleanupOnExit -{ -public: - ~wxCleanupOnExit() { wxEntryCleanup(); } -}; - // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- @@ -422,7 +414,9 @@ void wxEntryCleanup() int wxEntryReal(int& argc, wxChar **argv) { // library initialization - if ( !wxEntryStart(argc, argv) ) + wxInitializer initializer(argc, argv); + + if ( !initializer.IsOk() ) { #if wxUSE_LOG // flush any log messages explaining why we failed @@ -431,12 +425,6 @@ int wxEntryReal(int& argc, wxChar **argv) return -1; } - // if wxEntryStart succeeded, we must call wxEntryCleanup even if the code - // below returns or throws - wxCleanupOnExit cleanupOnExit; - - WX_SUPPRESS_UNUSED_WARN(cleanupOnExit); - wxTRY { // app initialization