From 12507a7cc2dcbc4f4c85acaafda8596de9364048 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Fri, 21 Oct 2011 11:38:31 +0200 Subject: [PATCH] win32: Call GetQueueStatus instead of PeekMessage PM_NOREMOVE Calling PeekMessage can cause reentrant calls into the window procedure for sent (as opposed to posted) messages, so its not safe to call when we're not expecting reentrancy. Instead we call GetQueueStatus when we're just looking for availible messages. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=552041 --- gdk/win32/gdkevents-win32.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index d2b2fdd93..36b4ff729 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -375,10 +375,9 @@ _gdk_events_init (void) gboolean gdk_events_pending (void) { - MSG msg; return (_gdk_event_queue_find_first (_gdk_display) || (modal_win32_dialog == NULL && - PeekMessageW (&msg, NULL, 0, 0, PM_NOREMOVE))); + GetQueueStatus (QS_ALLINPUT) != 0)); } GdkEvent* @@ -3563,7 +3562,6 @@ static gboolean gdk_event_prepare (GSource *source, gint *timeout) { - MSG msg; gboolean retval; GDK_THREADS_ENTER (); @@ -3572,7 +3570,7 @@ gdk_event_prepare (GSource *source, retval = (_gdk_event_queue_find_first (_gdk_display) != NULL || (modal_win32_dialog == NULL && - PeekMessageW (&msg, NULL, 0, 0, PM_NOREMOVE))); + GetQueueStatus (QS_ALLINPUT) != 0)); GDK_THREADS_LEAVE (); @@ -3582,7 +3580,6 @@ gdk_event_prepare (GSource *source, static gboolean gdk_event_check (GSource *source) { - MSG msg; gboolean retval; GDK_THREADS_ENTER (); @@ -3591,7 +3588,7 @@ gdk_event_check (GSource *source) { retval = (_gdk_event_queue_find_first (_gdk_display) != NULL || (modal_win32_dialog == NULL && - PeekMessageW (&msg, NULL, 0, 0, PM_NOREMOVE))); + GetQueueStatus (QS_ALLINPUT) != 0)); } else {