mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
Free the TEB on thread termination. Partially fixes a recent regression
svn path=/trunk/; revision=7322
This commit is contained in:
parent
d8575f7b6a
commit
baea3fcd85
1 changed files with 13 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: kill.c,v 1.68 2003/12/30 00:12:47 hyperion Exp $
|
||||
/* $Id: kill.c,v 1.69 2003/12/30 03:27:52 hyperion Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -125,6 +125,7 @@ PsTerminateCurrentThread(NTSTATUS ExitStatus)
|
|||
PKMUTANT Mutant;
|
||||
BOOLEAN Last;
|
||||
PEPROCESS CurrentProcess;
|
||||
SIZE_T Length = PAGE_SIZE;
|
||||
|
||||
KeLowerIrql(PASSIVE_LEVEL);
|
||||
|
||||
|
@ -144,9 +145,20 @@ PsTerminateCurrentThread(NTSTATUS ExitStatus)
|
|||
|
||||
KeReleaseSpinLock(&PiThreadListLock, oldIrql);
|
||||
|
||||
/* Notify subsystems of the thread termination */
|
||||
PspRunCreateThreadNotifyRoutines(CurrentThread, FALSE);
|
||||
PsTerminateWin32Thread(CurrentThread);
|
||||
|
||||
/* Free the TEB */
|
||||
if(CurrentThread->Tcb.Teb)
|
||||
ZwFreeVirtualMemory
|
||||
(
|
||||
NtCurrentProcess(),
|
||||
(PVOID *)&CurrentThread->Tcb.Teb,
|
||||
&Length,
|
||||
MEM_RELEASE
|
||||
);
|
||||
|
||||
/* abandon all owned mutants */
|
||||
current_entry = CurrentThread->Tcb.MutantListHead.Flink;
|
||||
while (current_entry != &CurrentThread->Tcb.MutantListHead)
|
||||
|
|
Loading…
Reference in a new issue