Fix ref counting bug
authorGé van Geldorp <ge@gse.nl>
Mon, 3 Jan 2005 09:46:31 +0000 (09:46 +0000)
committerGé van Geldorp <ge@gse.nl>
Mon, 3 Jan 2005 09:46:31 +0000 (09:46 +0000)
svn path=/trunk/; revision=12749

reactos/subsys/win32k/ntuser/cursoricon.c

index b456b72..40a27a6 100644 (file)
@@ -343,21 +343,25 @@ IntFindExistingCurIconObject(PWINSTATION_OBJECT WinStaObject, HMODULE hModule,
   {
     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)))
-      {
-        ObmDereferenceObject(Object);
-       continue;
-      }
-      if (! ReferenceCurIconByProcess(Object))
+      if((Object->hModule == hModule) && (Object->hRsrc == hRsrc))
       {
+        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);