Fix ref counting bug Modified: trunk/reactos/subsys/win32k/ntuser/cursoricon.c _____
Modified: trunk/reactos/subsys/win32k/ntuser/cursoricon.c --- trunk/reactos/subsys/win32k/ntuser/cursoricon.c 2005-01-03 05:17:16 UTC (rev 12748) +++ trunk/reactos/subsys/win32k/ntuser/cursoricon.c 2005-01-03 09:46:31 UTC (rev 12749) @@ -343,21 +343,25 @@
{ Object = CONTAINING_RECORD(CurrentEntry, CURICON_OBJECT, ListEntry); CurrentEntry = CurrentEntry->Flink; - if((Object->hModule == hModule) && (Object->hRsrc == hRsrc)) + if(NT_SUCCESS(ObmReferenceObjectByPointer(Object, otCursorIcon))) { - if(cx && ((cx != Object->Size.cx) || (cy != Object->Size.cy))) + if((Object->hModule == hModule) && (Object->hRsrc == hRsrc)) { - ObmDereferenceObject(Object); - continue; - } - if (! ReferenceCurIconByProcess(Object)) - { + if(cx && ((cx != Object->Size.cx) || (cy != Object->Size.cy))) + { + ObmDereferenceObject(Object); + continue; + } + if (! ReferenceCurIconByProcess(Object)) + { + ExReleaseFastMutex(&CurIconListLock); + return NULL; + } ExReleaseFastMutex(&CurIconListLock); - return NULL; + return Object; } - ExReleaseFastMutex(&CurIconListLock); - return Object; } + ObmDereferenceObject(Object); }
ExReleaseFastMutex(&CurIconListLock);