added assert to detect attempt to install idle handler from widget callback

not called from main thread


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20583 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Gilles Depeyrot
2003-05-11 16:44:48 +00:00
parent 275a63e3a6
commit d5f3e1ebf5
2 changed files with 16 additions and 2 deletions

View File

@@ -168,6 +168,8 @@ bool wxApp::Yield(bool onlyIfNeeded)
// wxWakeUpIdle
//-----------------------------------------------------------------------------
static bool gs_WakeUpIdle = false;
void wxWakeUpIdle()
{
#if wxUSE_THREADS
@@ -175,8 +177,11 @@ void wxWakeUpIdle()
wxMutexGuiEnter();
#endif
if (g_isIdle)
if (g_isIdle) {
gs_WakeUpIdle = true;
wxapp_install_idle_handler();
gs_WakeUpIdle = false;
}
#if wxUSE_THREADS
if (!wxThread::IsMain())
@@ -361,6 +366,8 @@ static gint wxapp_poll_func( GPollFD *ufds, guint nfds, gint timeout )
void wxapp_install_idle_handler()
{
wxASSERT_MSG( wxThread::IsMain() || gs_WakeUpIdle, wxT("attempt to install idle handler from widget callback in child thread (should be exclusively from wxWakeUpIdle)") );
wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
g_isIdle = FALSE;

View File

@@ -168,6 +168,8 @@ bool wxApp::Yield(bool onlyIfNeeded)
// wxWakeUpIdle
//-----------------------------------------------------------------------------
static bool gs_WakeUpIdle = false;
void wxWakeUpIdle()
{
#if wxUSE_THREADS
@@ -175,8 +177,11 @@ void wxWakeUpIdle()
wxMutexGuiEnter();
#endif
if (g_isIdle)
if (g_isIdle) {
gs_WakeUpIdle = true;
wxapp_install_idle_handler();
gs_WakeUpIdle = false;
}
#if wxUSE_THREADS
if (!wxThread::IsMain())
@@ -361,6 +366,8 @@ static gint wxapp_poll_func( GPollFD *ufds, guint nfds, gint timeout )
void wxapp_install_idle_handler()
{
wxASSERT_MSG( wxThread::IsMain() || gs_WakeUpIdle, wxT("attempt to install idle handler from widget callback in child thread (should be exclusively from wxWakeUpIdle)") );
wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
g_isIdle = FALSE;