fix compilation after the last change in msw/thread.cpp: we can't use wxEventLoop from there; use the hack described at http://article.gmane.org/gmane.comp.lib.wxwidgets.devel/83190 instead
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44404 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -30,6 +30,23 @@
|
||||
#include "wx/app.h"
|
||||
#endif //WX_PRECOMP
|
||||
|
||||
// see the comment near the declaration of wxRunningEventLoopCount in
|
||||
// src/msw/thread.cpp for the explanation of this hack
|
||||
#ifdef __WXMSW__
|
||||
|
||||
extern int wxRunningEventLoopCount;
|
||||
struct wxRunningEventLoopCounter
|
||||
{
|
||||
wxRunningEventLoopCounter() { wxRunningEventLoopCount++; }
|
||||
~wxRunningEventLoopCounter() { wxRunningEventLoopCount--; }
|
||||
};
|
||||
|
||||
#else // !__WXMSW__
|
||||
|
||||
struct wxRunningEventLoopCounter { };
|
||||
|
||||
#endif // __WXMSW__/!__WXMSW__
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// globals
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -59,6 +76,8 @@ int wxEventLoopManual::Run()
|
||||
// should undo
|
||||
wxEventLoopActivator activate(wx_static_cast(wxEventLoop *, this));
|
||||
|
||||
wxRunningEventLoopCounter evtLoopCounter;
|
||||
|
||||
// we must ensure that OnExit() is called even if an exception is thrown
|
||||
// from inside Dispatch() but we must call it from Exit() in normal
|
||||
// situations because it is supposed to be called synchronously,
|
||||
|
@@ -86,6 +86,16 @@
|
||||
#define THREAD_CALLCONV WINAPI
|
||||
#endif
|
||||
|
||||
// this is a hack to allow the code here to know whether wxEventLoop is
|
||||
// currently running: as wxBase doesn't have event loop at all, we can't simple
|
||||
// use "wxEventLoop::GetActive() != NULL" test, so instead wxEventLoop uses
|
||||
// this variable to indicate whether it is active
|
||||
//
|
||||
// the proper solution is to use wxAppTraits to abstract the base/GUI-dependent
|
||||
// operation of waiting for the thread to terminate and is already implemented
|
||||
// in cvs HEAD, this is just a backwards compatible hack for 2.8
|
||||
int wxRunningEventLoopCount = 0;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -755,7 +765,7 @@ wxThreadInternal::WaitForTerminate(wxCriticalSection& cs,
|
||||
#if !defined(QS_ALLPOSTMESSAGE)
|
||||
#define QS_ALLPOSTMESSAGE 0
|
||||
#endif
|
||||
if ( !wxEventLoop::GetActive() )
|
||||
if ( !wxRunningEventLoopCount )
|
||||
{
|
||||
// don't ask for Windows messages if we don't have a running event
|
||||
// loop to process them as otherwise we'd enter an infinite loop
|
||||
|
Reference in New Issue
Block a user