Index: ui/win32/win32ui.c =================================================================== --- ui/win32/win32ui.c (revision 4687) +++ ui/win32/win32ui.c (working copy) @@ -67,6 +67,9 @@ /* this helps pause fuse while the main window is minimized */ static int size_paused = 0; +/* this helps to finalize some blocking operations */ +static int exit_process_messages = 0; + /* Structure used by the radio button selection widgets (eg the graphics filter selectors and Machine/Select) */ typedef struct win32ui_select_info { @@ -247,6 +250,12 @@ is open and inactive */ break; + case WM_USER_EXIT_PROCESS_MESSAGES: + /* Odd case when message loop is overridden by a modal dialog. This + should not be caught here, so we delay this notification */ + exit_process_messages++; + return 0; + #if defined USE_JOYSTICK && !defined HAVE_JSW_H case MM_JOY1BUTTONDOWN: @@ -1167,7 +1176,14 @@ } } if( process_queue_once ) return; - + + /* If we miss WM_USER_EXIT_PROCESS_MESSAGES, the window procedure will + kindly notify us */ + if( exit_process_messages ) { + exit_process_messages--; + return; + } + WaitMessage(); } /* FIXME: somewhere there should be return msg.wParam */