X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4f6b94a33a3d8779c078740b3eae2090015c838a..36abe9d421ebb33873f012a63fbdb210ff771682:/src/common/appbase.cpp diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 7a6978b255..7b2636e47c 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" @@ -144,7 +131,7 @@ wxAppConsoleBase::wxAppConsoleBase() m_traits = NULL; m_mainLoop = NULL; - ms_appInstance = wx_static_cast(wxAppConsole *, this); + ms_appInstance = static_cast(this); #ifdef __WXDEBUG__ SetTraceMasks(); @@ -167,7 +154,7 @@ wxAppConsoleBase::~wxAppConsoleBase() // initilization/cleanup // ---------------------------------------------------------------------------- -bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc), wxChar **WXUNUSED(argv)) +bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc), wxChar **argv) { #if wxUSE_INTL GetTraits()->SetLocale(); @@ -178,7 +165,7 @@ bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc), wxChar **WXUNUSED(argv)) #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); @@ -290,6 +277,13 @@ wxAppTraits *wxAppConsoleBase::GetTraits() return m_traits; } +/* static */ +wxAppTraits *wxAppConsoleBase::GetTraitsIfExists() +{ + wxAppConsole * const app = GetInstance(); + return app ? app->GetTraits() : NULL; +} + // ---------------------------------------------------------------------------- // event processing // ---------------------------------------------------------------------------- @@ -673,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