mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 19:55:41 +00:00
[NTUSER] Do assignment lock pti->spDefaultImc (#4456)
According to JIRA user simonelombardo, there was crash in exiting a thread. - Add UserAssignmentLock, and UserAssignmentUnlock helper functions. - Lock and unlock pti->spDefaultImc by using those helper functions. CORE-18044
This commit is contained in:
parent
851c5e0c3a
commit
7e13883723
4 changed files with 41 additions and 3 deletions
|
@ -1362,9 +1362,7 @@ PIMC FASTCALL UserCreateInputContext(ULONG_PTR dwClientImcData)
|
||||||
else // First time. It's the default IMC.
|
else // First time. It's the default IMC.
|
||||||
{
|
{
|
||||||
// Add the first one (default) to the list.
|
// Add the first one (default) to the list.
|
||||||
if (pti->spDefaultImc)
|
UserAssignmentLock((PVOID*)&pti->spDefaultImc, pIMC);
|
||||||
UserDereferenceObject(pti->spDefaultImc);
|
|
||||||
pti->spDefaultImc = pIMC;
|
|
||||||
pIMC->pImcNext = NULL;
|
pIMC->pImcNext = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -696,6 +696,7 @@ error:
|
||||||
VOID
|
VOID
|
||||||
UserDisplayNotifyShutdown(PPROCESSINFO ppiCurrent);
|
UserDisplayNotifyShutdown(PPROCESSINFO ppiCurrent);
|
||||||
|
|
||||||
|
// Win: xxxDestroyThreadInfo
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
ExitThreadCallback(PETHREAD Thread)
|
ExitThreadCallback(PETHREAD Thread)
|
||||||
|
@ -783,6 +784,7 @@ ExitThreadCallback(PETHREAD Thread)
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
UserAssignmentUnlock((PVOID*)&ptiCurrent->spDefaultImc);
|
||||||
|
|
||||||
if (ppiCurrent && ppiCurrent->ptiList == ptiCurrent && !ptiCurrent->ptiSibling &&
|
if (ppiCurrent && ppiCurrent->ptiList == ptiCurrent && !ptiCurrent->ptiSibling &&
|
||||||
ppiCurrent->W32PF_flags & W32PF_CLASSESREGISTERED)
|
ppiCurrent->W32PF_flags & W32PF_CLASSESREGISTERED)
|
||||||
|
|
|
@ -801,3 +801,39 @@ CLEANUP:
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Win: HMAssignmentLock
|
||||||
|
PVOID FASTCALL UserAssignmentLock(PVOID *ppvObj, PVOID pvNew)
|
||||||
|
{
|
||||||
|
PVOID pvOld = *ppvObj;
|
||||||
|
*ppvObj = pvNew;
|
||||||
|
|
||||||
|
if (pvOld && pvOld == pvNew)
|
||||||
|
return pvOld;
|
||||||
|
|
||||||
|
if (pvNew)
|
||||||
|
UserReferenceObject(pvNew);
|
||||||
|
|
||||||
|
if (pvOld)
|
||||||
|
{
|
||||||
|
if (UserDereferenceObject(pvOld))
|
||||||
|
pvOld = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pvOld;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Win: HMAssignmentUnlock
|
||||||
|
PVOID FASTCALL UserAssignmentUnlock(PVOID *ppvObj)
|
||||||
|
{
|
||||||
|
PVOID pvOld = *ppvObj;
|
||||||
|
*ppvObj = NULL;
|
||||||
|
|
||||||
|
if (pvOld)
|
||||||
|
{
|
||||||
|
if (UserDereferenceObject(pvOld))
|
||||||
|
pvOld = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pvOld;
|
||||||
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ void DbgUserDumpHandleTable();
|
||||||
PVOID FASTCALL ValidateHandle(HANDLE handle, HANDLE_TYPE type);
|
PVOID FASTCALL ValidateHandle(HANDLE handle, HANDLE_TYPE type);
|
||||||
BOOLEAN UserDestroyObjectsForOwner(PUSER_HANDLE_TABLE Table, PVOID Owner);
|
BOOLEAN UserDestroyObjectsForOwner(PUSER_HANDLE_TABLE Table, PVOID Owner);
|
||||||
BOOL FASTCALL UserMarkObjectDestroy(PVOID);
|
BOOL FASTCALL UserMarkObjectDestroy(PVOID);
|
||||||
|
PVOID FASTCALL UserAssignmentLock(PVOID *ppvObj, PVOID pvNew);
|
||||||
|
PVOID FASTCALL UserAssignmentUnlock(PVOID *ppvObj);
|
||||||
|
|
||||||
static __inline VOID
|
static __inline VOID
|
||||||
UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
|
UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue