diff --git a/reactos/win32ss/user/ntuser/class.c b/reactos/win32ss/user/ntuser/class.c index 1474e0c6027..f54626dae8a 100644 --- a/reactos/win32ss/user/ntuser/class.c +++ b/reactos/win32ss/user/ntuser/class.c @@ -128,6 +128,7 @@ static VOID IntDestroyClass(IN OUT PCLS Class) { PDESKTOP pDesk; + /* There shouldn't be any clones anymore */ ASSERT(Class->cWndReferenceCount == 0); ASSERT(Class->pclsClone == NULL); @@ -620,9 +621,11 @@ IntDereferenceClass(IN OUT PCLS Class, { PCLS *PrevLink, BaseClass, CurrentClass; + ASSERT(Class->cWndReferenceCount >= 1); + BaseClass = Class->pclsBase; - if (--Class->cWndReferenceCount <= 0) + if (--Class->cWndReferenceCount == 0) { if (BaseClass == Class) { diff --git a/reactos/win32ss/user/ntuser/main.c b/reactos/win32ss/user/ntuser/main.c index 9c145b2b880..8543fa477e5 100644 --- a/reactos/win32ss/user/ntuser/main.c +++ b/reactos/win32ss/user/ntuser/main.c @@ -175,9 +175,6 @@ Win32kProcessCallback(struct _EPROCESS *Process, IntCleanupMenus(Process, ppiCurrent); IntCleanupCurIcons(Process, ppiCurrent); - /* no process windows should exist at this point, or the function will assert! */ - DestroyProcessClasses(ppiCurrent); - ppiCurrent->W32PF_flags &= ~W32PF_CLASSESREGISTERED; GDI_CleanupForProcess(Process); @@ -205,6 +202,8 @@ Win32kProcessCallback(struct _EPROCESS *Process, GdiPoolDestroy(ppiCurrent->pPoolBrushAttr); GdiPoolDestroy(ppiCurrent->pPoolRgnAttr); + if (gppiInputProvider == ppiCurrent) gppiInputProvider = NULL; + TRACE_CH(UserProcess,"Freeing ppi 0x%x\n", ppiCurrent); /* Ftee the PROCESSINFO */ @@ -432,7 +431,22 @@ UserDestroyThreadInfo(struct _ETHREAD *Thread) DestroyTimersForThread(ptiCurrent); KeSetEvent(ptiCurrent->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); UnregisterThreadHotKeys(Thread); +/* + if (IsListEmpty(&ptiCurrent->WindowListHead)) + { + ERR_CH(UserThread,"Thread Window List is Empty!\n"); + } +*/ co_DestroyThreadWindows(Thread); + + if (ppiCurrent && ppiCurrent->ptiList == ptiCurrent && !ptiCurrent->ptiSibling) + { + //ERR_CH(UserThread,"DestroyProcessClasses\n"); + /* no process windows should exist at this point, or the function will assert! */ + DestroyProcessClasses(ppiCurrent); + ppiCurrent->W32PF_flags &= ~W32PF_CLASSESREGISTERED; + } + IntBlockInput(ptiCurrent, FALSE); IntCleanupThreadCallbacks(ptiCurrent); diff --git a/reactos/win32ss/user/ntuser/ntuser.c b/reactos/win32ss/user/ntuser/ntuser.c index e5478c44da6..e7b505edbd2 100644 --- a/reactos/win32ss/user/ntuser/ntuser.c +++ b/reactos/win32ss/user/ntuser/ntuser.c @@ -11,6 +11,7 @@ DBG_DEFAULT_CHANNEL(UserMisc); /* GLOBALS *******************************************************************/ PTHREADINFO gptiCurrent = NULL; +PPROCESSINFO gppiInputProvider = NULL; ERESOURCE UserLock; ATOM AtomMessage; // Window Message atom. ATOM AtomWndObj; // Window Object atom. diff --git a/reactos/win32ss/user/ntuser/ntuser.h b/reactos/win32ss/user/ntuser/ntuser.h index 1f97e9554d2..b45a2d0843b 100644 --- a/reactos/win32ss/user/ntuser/ntuser.h +++ b/reactos/win32ss/user/ntuser/ntuser.h @@ -13,6 +13,7 @@ extern BOOL gbInitialized; extern PSERVERINFO gpsi; extern PTHREADINFO gptiCurrent; extern PPROCESSINFO ppiScrnSaver; +extern PPROCESSINFO gppiInputProvider; INIT_FUNCTION NTSTATUS NTAPI InitUserImpl(VOID); VOID FASTCALL CleanupUserImpl(VOID);