Don't callback from kernel to usermode if the thread is exiting

svn path=/trunk/; revision=8042
This commit is contained in:
Gé van Geldorp 2004-02-05 20:09:10 +00:00
parent a7be90ed0b
commit 55d09ef598
3 changed files with 18 additions and 7 deletions

View file

@ -11,6 +11,7 @@ typedef struct _W32THREAD
struct _KBDTABLES* KeyboardLayout;
struct _DESKTOP_OBJECT* Desktop;
DWORD MessagePumpHookValue;
BOOLEAN IsExiting;
} W32THREAD, *PW32THREAD;
#include <poppack.h>
@ -30,8 +31,8 @@ typedef struct _W32PROCESS
struct _WINSTATION_OBJECT* WindowStation;
WORD GDIObjects;
WORD UserObjects;
BOOL CreatedWindowOrDC;
BOOL ManualGuiCheck;
BOOLEAN CreatedWindowOrDC;
BOOLEAN ManualGuiCheck;
} W32PROCESS, *PW32PROCESS;
PW32THREAD STDCALL

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: dllmain.c,v 1.65 2004/01/24 08:26:25 ekohl Exp $
/* $Id: dllmain.c,v 1.66 2004/02/05 20:09:10 gvg Exp $
*
* Entry Point for win32k.sys
*/
@ -141,6 +141,7 @@ Win32kThreadCallback (struct _ETHREAD *Thread,
DbgPrint (" Create thread\n");
#endif
Win32Thread->IsExiting = FALSE;
IntDestroyCaret(Win32Thread);
Win32Thread->MessageQueue = MsqCreateMessageQueue(Thread);
Win32Thread->KeyboardLayout = W32kGetDefaultKeyLayout();
@ -170,6 +171,7 @@ Win32kThreadCallback (struct _ETHREAD *Thread,
DbgPrint (" Destroy thread\n");
#endif
Win32Thread->IsExiting = TRUE;
HOOK_DestroyThreadHooks(Thread);
RemoveTimersThread(Thread->Cid.UniqueThread);
UnregisterThreadHotKeys(Thread);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: message.c,v 1.48 2004/01/28 20:54:30 gvg Exp $
/* $Id: message.c,v 1.49 2004/02/05 20:09:10 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -716,6 +716,7 @@ IntSendMessage(HWND hWnd,
PMSGMEMORY MsgMemoryEntry;
INT lParamBufferSize;
LPARAM lParamPacked;
PW32THREAD Win32Thread;
/* FIXME: Check for a broadcast or topmost destination. */
@ -727,11 +728,18 @@ IntSendMessage(HWND hWnd,
return 0;
}
/* FIXME: Check for an exiting window. */
Win32Thread = PsGetWin32Thread();
if (NULL != PsGetWin32Thread() &&
Window->MessageQueue == PsGetWin32Thread()->MessageQueue)
if (NULL != Win32Thread &&
Window->MessageQueue == Win32Thread->MessageQueue)
{
if (Win32Thread->IsExiting)
{
/* Never send messages to exiting threads */
IntReleaseWindowObject(Window);
return 0;
}
/* See if this message type is present in the table */
MsgMemoryEntry = FindMsgMemory(Msg);
if (NULL == MsgMemoryEntry)