X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9b4da62701dbe8ccfbe447ce8d1bc77fcb40e9e5..472137baebae6c011ad7d70285de454b9ce7796d:/src/common/appbase.cpp diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 857b157822..076cabb60f 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -63,19 +63,6 @@ #include "wx/fontmap.h" #endif // wxUSE_FONTMAP -#if defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS - // For MacTypes.h for Debugger function - #include -#endif - -#if defined(__WXMAC__) - #ifdef __DARWIN__ - #include - #else - #include "wx/mac/private.h" // includes mac headers - #endif -#endif // __WXMAC__ - #ifdef __WXDEBUG__ #if wxUSE_STACKWALKER #include "wx/stackwalk.h" @@ -167,22 +154,18 @@ wxAppConsoleBase::~wxAppConsoleBase() // initilization/cleanup // ---------------------------------------------------------------------------- -bool wxAppConsoleBase::Initialize(int& argcOrig, wxChar **argvOrig) +bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc), wxChar **argv) { #if wxUSE_INTL GetTraits()->SetLocale(); #endif // wxUSE_INTL - // remember the command line arguments - argc = argcOrig; - argv = argvOrig; - #if wxUSE_THREADS wxPendingEventsLocker = new wxCriticalSection; #endif #ifndef __WXPALMOS__ - if ( m_appName.empty() && argv ) + if ( m_appName.empty() && argv && argv[0] ) { // the application name is, by default, the name of its executable file wxFileName::SplitPath(argv[0], NULL, &m_appName, NULL); @@ -294,6 +277,13 @@ wxAppTraits *wxAppConsoleBase::GetTraits() return m_traits; } +/* static */ +wxAppTraits *wxAppConsoleBase::GetTraitsIfExists() +{ + wxAppConsole * const app = GetInstance(); + return app ? app->GetTraits() : NULL; +} + // ---------------------------------------------------------------------------- // event processing // ---------------------------------------------------------------------------- @@ -677,12 +667,16 @@ void wxAppTraitsBase::MutexGuiLeave() void WXDLLIMPEXP_BASE wxMutexGuiEnter() { - wxAppConsoleBase::GetInstance()->GetTraits()->MutexGuiEnter(); + wxAppTraits * const traits = wxAppConsoleBase::GetTraitsIfExists(); + if ( traits ) + traits->MutexGuiEnter(); } void WXDLLIMPEXP_BASE wxMutexGuiLeave() { - wxAppConsoleBase::GetInstance()->GetTraits()->MutexGuiLeave(); + wxAppTraits * const traits = wxAppConsoleBase::GetTraitsIfExists(); + if ( traits ) + traits->MutexGuiLeave(); } #endif // wxUSE_THREADS