X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7705c44f292e8ed629f4b49500c2b33b8d903657..af7e24c33e1e6e00a7687ee965b921dbe60cdb36:/src/common/appbase.cpp diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index db26530d66..f2bed9aca8 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -154,6 +154,10 @@ wxAppConsoleBase::wxAppConsoleBase() wxAppConsoleBase::~wxAppConsoleBase() { + // we're being destroyed and using this object from now on may not work or + // even crash so don't leave dangling pointers to it + ms_appInstance = NULL; + delete m_traits; } @@ -161,21 +165,45 @@ wxAppConsoleBase::~wxAppConsoleBase() // initialization/cleanup // ---------------------------------------------------------------------------- -bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc), wxChar **argv) +bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc), wxChar **WXUNUSED(argv)) { #if wxUSE_INTL GetTraits()->SetLocale(); #endif // wxUSE_INTL + return true; +} + +wxString wxAppConsoleBase::GetAppName() const +{ + wxString name = m_appName; #ifndef __WXPALMOS__ - if ( m_appName.empty() && argv && argv[0] ) + if ( name.empty() ) { - // the application name is, by default, the name of its executable file - wxFileName::SplitPath(argv[0], NULL, &m_appName, NULL); + if ( argv ) + { + // the application name is, by default, the name of its executable file + wxFileName::SplitPath(argv[0], NULL, &name, NULL); + } } #endif // !__WXPALMOS__ + return name; +} - return true; +wxString wxAppConsoleBase::GetAppDisplayName() const +{ + // use the explicitly provided display name, if any + if ( !m_appDisplayName.empty() ) + return m_appDisplayName; + + // if the application name was explicitly set, use it as is as capitalizing + // it won't always produce good results + if ( !m_appName.empty() ) + return m_appName; + + // if neither is set, use the capitalized version of the program file as + // it's the most reasonable default + return GetAppName().Capitalize(); } wxEventLoopBase *wxAppConsoleBase::CreateMainLoop() @@ -340,6 +368,12 @@ bool wxAppConsoleBase::ProcessIdle() event.SetEventObject(this); ProcessEvent(event); +#if wxUSE_LOG + // flush the logged messages if any (do this after processing the events + // which could have logged new messages) + wxLog::FlushActive(); +#endif + return event.MoreRequested(); } @@ -505,7 +539,7 @@ void wxAppConsoleBase::DeletePendingEvents() bool wxAppConsoleBase::IsScheduledForDestruction(wxObject *object) const { - return wxPendingDelete.Member(object) != NULL; + return wxPendingDelete.Member(object); } void wxAppConsoleBase::ScheduleForDestruction(wxObject *object) @@ -1016,6 +1050,11 @@ wxDefaultAssertHandler(const wxString& file, wxAssertHandler_t wxTheAssertHandler = wxDefaultAssertHandler; +void wxSetDefaultAssertHandler() +{ + wxTheAssertHandler = wxDefaultAssertHandler; +} + void wxOnAssert(const wxString& file, int line, const wxString& func,