#endif // __WXDEBUG__
gint m_idleTag;
+ void RemoveIdleTag();
+
unsigned char *m_colorCube;
// Used by the the wxGLApp and wxGLCanvas class for GL-based X visual
#endif // __WXDEBUG__
gint m_idleTag;
+ void RemoveIdleTag();
+
unsigned char *m_colorCube;
// Used by the the wxGLApp and wxGLCanvas class for GL-based X visual
#include "wx/filename.h"
#include "wx/module.h"
#include "wx/image.h"
+#include "wx/thread.h"
#ifdef __WXGPE__
#include <gpe/init.h>
void wxapp_install_idle_handler();
+#if wxUSE_THREADS
+static wxMutex gs_idleTagsMutex;
+#endif
+
//-----------------------------------------------------------------------------
// wxYield
//-----------------------------------------------------------------------------
{
// We need to remove idle callbacks or the loop will
// never finish.
- gtk_idle_remove( m_idleTag );
- m_idleTag = 0;
+ wxTheApp->RemoveIdleTag();
g_isIdle = TRUE;
}
// Sent idle event to all who request them.
wxTheApp->ProcessPendingEvents();
- g_pendingTag = 0;
+ {
+#if wxUSE_THREADS
+ wxMutexLocker lock(gs_idleTagsMutex);
+#endif
+ g_pendingTag = 0;
+ }
// Flush the logged messages if any.
#if wxUSE_LOG
// Indicate that we are now in idle mode and event handlers
// will have to reinstall the idle handler again.
- g_isIdle = TRUE;
- wxTheApp->m_idleTag = 0;
+ {
+#if wxUSE_THREADS
+ wxMutexLocker lock(gs_idleTagsMutex);
+#endif
+ g_isIdle = TRUE;
+ wxTheApp->m_idleTag = 0;
+ }
// Send idle event to all who request them as long as
// no events have popped up in the event queue.
void wxapp_install_idle_handler()
{
+#if wxUSE_THREADS
+ wxMutexLocker lock(gs_idleTagsMutex);
+#endif
+
// GD: this assert is raised when using the thread sample (which works)
// so the test is probably not so easy. Can widget callbacks be
// triggered from child threads and, if so, for which widgets?
#endif // __WXDEBUG__
+void wxApp::RemoveIdleTag()
+{
+#if wxUSE_THREADS
+ wxMutexLocker lock(gs_idleTagsMutex);
+#endif
+ gtk_idle_remove( wxTheApp->m_idleTag );
+ wxTheApp->m_idleTag = 0;
+}
{
// We need to remove idle callbacks or gtk_events_pending will
// never return false.
- gtk_idle_remove( wxTheApp->m_idleTag );
- wxTheApp->m_idleTag = 0;
+ wxTheApp->RemoveIdleTag();
g_isIdle = TRUE;
}
#include "wx/filename.h"
#include "wx/module.h"
#include "wx/image.h"
+#include "wx/thread.h"
#ifdef __WXGPE__
#include <gpe/init.h>
void wxapp_install_idle_handler();
+#if wxUSE_THREADS
+static wxMutex gs_idleTagsMutex;
+#endif
+
//-----------------------------------------------------------------------------
// wxYield
//-----------------------------------------------------------------------------
{
// We need to remove idle callbacks or the loop will
// never finish.
- gtk_idle_remove( m_idleTag );
- m_idleTag = 0;
+ wxTheApp->RemoveIdleTag();
g_isIdle = TRUE;
}
// Sent idle event to all who request them.
wxTheApp->ProcessPendingEvents();
- g_pendingTag = 0;
+ {
+#if wxUSE_THREADS
+ wxMutexLocker lock(gs_idleTagsMutex);
+#endif
+ g_pendingTag = 0;
+ }
// Flush the logged messages if any.
#if wxUSE_LOG
// Indicate that we are now in idle mode and event handlers
// will have to reinstall the idle handler again.
- g_isIdle = TRUE;
- wxTheApp->m_idleTag = 0;
+ {
+#if wxUSE_THREADS
+ wxMutexLocker lock(gs_idleTagsMutex);
+#endif
+ g_isIdle = TRUE;
+ wxTheApp->m_idleTag = 0;
+ }
// Send idle event to all who request them as long as
// no events have popped up in the event queue.
void wxapp_install_idle_handler()
{
+#if wxUSE_THREADS
+ wxMutexLocker lock(gs_idleTagsMutex);
+#endif
+
// GD: this assert is raised when using the thread sample (which works)
// so the test is probably not so easy. Can widget callbacks be
// triggered from child threads and, if so, for which widgets?
#endif // __WXDEBUG__
+void wxApp::RemoveIdleTag()
+{
+#if wxUSE_THREADS
+ wxMutexLocker lock(gs_idleTagsMutex);
+#endif
+ gtk_idle_remove( wxTheApp->m_idleTag );
+ wxTheApp->m_idleTag = 0;
+}
{
// We need to remove idle callbacks or gtk_events_pending will
// never return false.
- gtk_idle_remove( wxTheApp->m_idleTag );
- wxTheApp->m_idleTag = 0;
+ wxTheApp->RemoveIdleTag();
g_isIdle = TRUE;
}