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:
@@ -168,6 +168,8 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
// wxWakeUpIdle
|
// wxWakeUpIdle
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static bool gs_WakeUpIdle = false;
|
||||||
|
|
||||||
void wxWakeUpIdle()
|
void wxWakeUpIdle()
|
||||||
{
|
{
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
@@ -175,8 +177,11 @@ void wxWakeUpIdle()
|
|||||||
wxMutexGuiEnter();
|
wxMutexGuiEnter();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (g_isIdle)
|
if (g_isIdle) {
|
||||||
|
gs_WakeUpIdle = true;
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
gs_WakeUpIdle = false;
|
||||||
|
}
|
||||||
|
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
if (!wxThread::IsMain())
|
if (!wxThread::IsMain())
|
||||||
@@ -361,6 +366,8 @@ static gint wxapp_poll_func( GPollFD *ufds, guint nfds, gint timeout )
|
|||||||
|
|
||||||
void wxapp_install_idle_handler()
|
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") );
|
wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
|
||||||
|
|
||||||
g_isIdle = FALSE;
|
g_isIdle = FALSE;
|
||||||
|
@@ -168,6 +168,8 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
// wxWakeUpIdle
|
// wxWakeUpIdle
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static bool gs_WakeUpIdle = false;
|
||||||
|
|
||||||
void wxWakeUpIdle()
|
void wxWakeUpIdle()
|
||||||
{
|
{
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
@@ -175,8 +177,11 @@ void wxWakeUpIdle()
|
|||||||
wxMutexGuiEnter();
|
wxMutexGuiEnter();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (g_isIdle)
|
if (g_isIdle) {
|
||||||
|
gs_WakeUpIdle = true;
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
gs_WakeUpIdle = false;
|
||||||
|
}
|
||||||
|
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
if (!wxThread::IsMain())
|
if (!wxThread::IsMain())
|
||||||
@@ -361,6 +366,8 @@ static gint wxapp_poll_func( GPollFD *ufds, guint nfds, gint timeout )
|
|||||||
|
|
||||||
void wxapp_install_idle_handler()
|
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") );
|
wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
|
||||||
|
|
||||||
g_isIdle = FALSE;
|
g_isIdle = FALSE;
|
||||||
|
Reference in New Issue
Block a user