X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e0a050e347b1ece07ad5f165ba1b1d16edbeae77..82c126e50158efee5a1f46e1200be380c5199f8d:/src/common/appbase.cpp?ds=inline diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 119622bb8b..0a33d3b00f 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -330,16 +330,13 @@ bool wxAppConsoleBase::Dispatch() bool wxAppConsoleBase::HasPendingEvents() const { - // ensure that we're the only thread to modify the pending events list wxENTER_CRIT_SECT( *wxPendingEventsLocker ); - if ( !wxPendingEvents ) - { - wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); - return false; - } + bool has = wxPendingEvents && !wxPendingEvents->IsEmpty(); + wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); - return true; + + return has; } /* static */ @@ -357,27 +354,27 @@ void wxAppConsoleBase::ProcessPendingEvents() return; #endif - if ( !HasPendingEvents() ) - return; - wxENTER_CRIT_SECT( *wxPendingEventsLocker ); - // iterate until the list becomes empty - wxList::compatibility_iterator node = wxPendingEvents->GetFirst(); - while (node) + if (wxPendingEvents) { - wxEvtHandler *handler = (wxEvtHandler *)node->GetData(); - wxPendingEvents->Erase(node); + // iterate until the list becomes empty + wxList::compatibility_iterator node = wxPendingEvents->GetFirst(); + while (node) + { + wxEvtHandler *handler = (wxEvtHandler *)node->GetData(); + wxPendingEvents->Erase(node); - // In ProcessPendingEvents(), new handlers might be add - // and we can safely leave the critical section here. - wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); + // In ProcessPendingEvents(), new handlers might be add + // and we can safely leave the critical section here. + wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); - handler->ProcessPendingEvents(); + handler->ProcessPendingEvents(); - wxENTER_CRIT_SECT( *wxPendingEventsLocker ); + wxENTER_CRIT_SECT( *wxPendingEventsLocker ); - node = wxPendingEvents->GetFirst(); + node = wxPendingEvents->GetFirst(); + } } wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); @@ -469,7 +466,7 @@ bool wxAppConsoleBase::OnExceptionInMainLoop() #if wxUSE_CMDLINE_PARSER -#define OPTION_VERBOSE _T("verbose") +#define OPTION_VERBOSE "verbose" void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser) { @@ -478,8 +475,8 @@ void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser) { { wxCMD_LINE_SWITCH, - _T("h"), - _T("help"), + "h", + "help", gettext_noop("show this help message"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP @@ -488,7 +485,7 @@ void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser) #if wxUSE_LOG { wxCMD_LINE_SWITCH, - wxEmptyString, + NULL, OPTION_VERBOSE, gettext_noop("generate verbose log messages"), wxCMD_LINE_VAL_NONE, @@ -497,14 +494,7 @@ void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser) #endif // wxUSE_LOG // terminator - { - wxCMD_LINE_NONE, - wxEmptyString, - wxEmptyString, - wxEmptyString, - wxCMD_LINE_VAL_NONE, - 0x0 - } + wxCMD_LINE_DESC_END }; parser.SetDesc(cmdLineDesc); @@ -668,7 +658,7 @@ GSocketGUIFunctionsTable* wxConsoleAppTraitsBase::GetSocketGUIFunctionsTable() #if wxUSE_INTL void wxAppTraitsBase::SetLocale() { - setlocale(LC_ALL, ""); + wxSetlocale(LC_ALL, ""); wxUpdateLocaleIsUtf8(); } #endif @@ -800,12 +790,6 @@ void wxTrap() { #if defined(__WXMSW__) && !defined(__WXMICROWIN__) DebugBreak(); -#elif defined(__WXMAC__) && !defined(__DARWIN__) - #if __powerc - Debugger(); - #else - SysBreak(); - #endif #elif defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS Debugger(); #elif defined(__UNIX__) @@ -947,6 +931,7 @@ static void LINKAGEMODE SetTraceMasks() #endif // wxUSE_LOG } +static bool DoShowAssertDialog(const wxString& msg) { // under MSW we can show the dialog even in the console mode