X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1663c65500c557d53e94493b7cf59331852c064d..b74077ace2413000c5556cbe0c41ab210ac12c54:/src/common/appbase.cpp diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index a24fee5965..339fe276c4 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 ); @@ -668,7 +665,7 @@ GSocketGUIFunctionsTable* wxConsoleAppTraitsBase::GetSocketGUIFunctionsTable() #if wxUSE_INTL void wxAppTraitsBase::SetLocale() { - setlocale(LC_ALL, ""); + wxSetlocale(LC_ALL, ""); wxUpdateLocaleIsUtf8(); } #endif @@ -959,7 +956,7 @@ bool DoShowAssertDialog(const wxString& msg) wxT("You can also choose [Cancel] to suppress ") wxT("further warnings."); - switch ( ::MessageBox(NULL, msgDlg, _T("wxWidgets Debug Alert"), + switch ( ::MessageBox(NULL, msgDlg.wx_str(), _T("wxWidgets Debug Alert"), MB_YESNOCANCEL | MB_ICONSTOP ) ) { case IDYES: @@ -1027,7 +1024,7 @@ void ShowAssertDialog(const wxString& szFile, #if defined(__WXMSW__) && !defined(__WXMICROWIN__) msg << wxT("\r\n"); - OutputDebugString(msg ); + OutputDebugString(msg.wx_str()); #else // send to stderr wxFprintf(stderr, wxT("%s\n"), msg.c_str());