From a4401712c5513c0d0ef5eef4dcb07704a49afdb3 Mon Sep 17 00:00:00 2001 From: Alexander Gottwald Date: Mon, 12 Apr 2004 21:49:04 +0000 Subject: [PATCH] fix rare segfault caused by uninitialized event queue. Happend if FatalError Messagebox appeared because of missing font "fixed" --- hw/xwin/winkeybd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c index c70d47684..8fd9c49a6 100644 --- a/hw/xwin/winkeybd.c +++ b/hw/xwin/winkeybd.c @@ -359,14 +359,21 @@ void winRestoreModeKeyStates () { DWORD dwKeyState; + BOOL processEvents = TRUE; unsigned short internalKeyStates; /* X server is being initialized */ if (!g_winInternalModeKeyStatesPtr) return; + /* Only process events if the rootwindow is mapped. The keyboard events + * will cause segfaults otherwise */ + if (WindowTable && WindowTable[0] && WindowTable[0]->mapped == FALSE) + processEvents = FALSE; + /* Force to process all pending events in the mi event queue */ - mieqProcessInputEvents (); + if (processEvents) + mieqProcessInputEvents (); /* Read the mode key states of our X server */ internalKeyStates = *g_winInternalModeKeyStatesPtr;