From 696e4323aaeb0f40d9daa39175c20f02ce23c536 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Feb 2014 15:02:23 +0000 Subject: [PATCH] Don't log error from wxMSW wxWakeUpIdle(). This is not necessary as there is nothing that can be done about this error anyhow and the function still "works" even if it occurs (it doesn't wake up anything but it is not necessary to do it if the message queue is already full) and, worse, results in a crash due to stack overflow. Closes #15951. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75834 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/app.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 9d9b1ce161..ae5937c287 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -819,11 +819,15 @@ void wxApp::WakeUpIdle() if ( !::PeekMessage(&msg, hwndTop, 0, 1, PM_NOREMOVE) || ::PeekMessage(&msg, hwndTop, 1, 1, PM_NOREMOVE) ) { - if ( !::PostMessage(hwndTop, WM_NULL, 0, 0) ) - { - // should never happen - wxLogLastError(wxT("PostMessage(WM_NULL)")); - } + // If this fails too, there is really not much we can do, but then + // neither do we need to, as it normally indicates that the window + // queue is full to the brim with the messages and so the main loop + // is running and doesn't need to be woken up. + // + // Notice that we especially should not try use wxLogLastError() + // here as this would lead to another call to wxWakeUpIdle() from + // inside wxLog and stack overflow due to the resulting recursion. + ::PostMessage(hwndTop, WM_NULL, 0, 0); } } #if wxUSE_THREADS