Author: jgardou
Date: Tue Oct 21 19:57:03 2014
New Revision: 64879
URL:
http://svn.reactos.org/svn/reactos?rev=64879&view=rev
Log:
[WIN32K]
- Fix a few usages of UserSetCursor
- Defer the actual freeing of cursor resources to when the object is freed for real.
CORE-7575
Modified:
trunk/reactos/win32ss/user/ntuser/cursoricon.h
trunk/reactos/win32ss/user/ntuser/cursoricon_new.c
trunk/reactos/win32ss/user/ntuser/defwnd.c
trunk/reactos/win32ss/user/ntuser/desktop.c
trunk/reactos/win32ss/user/ntuser/display.c
trunk/reactos/win32ss/user/ntuser/object.c
trunk/reactos/win32ss/user/ntuser/object.h
Modified: trunk/reactos/win32ss/user/ntuser/cursoricon.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/cursor…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/cursoricon.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/cursoricon.h [iso-8859-1] Tue Oct 21 19:57:03 2014
@@ -46,6 +46,8 @@
VOID FASTCALL
IntCleanupCurIconCache(PPROCESSINFO Win32Process);
+
+void FreeCurIconObject(PVOID Object);
#else
Modified: trunk/reactos/win32ss/user/ntuser/cursoricon_new.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/cursor…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/cursoricon_new.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/cursoricon_new.c [iso-8859-1] Tue Oct 21 19:57:03
2014
@@ -150,7 +150,19 @@
}
BOOLEAN
-IntDestroyCurIconObject(PVOID Object)
+IntDestroyCurIconObject(
+ _In_ PVOID Object)
+{
+ PCURICON_OBJECT CurIcon = Object;
+
+ /* We just mark the handle as being destroyed.
+ * Deleting all the stuff will be deferred to the actual struct free. */
+ return UserDeleteObject(CurIcon->head.h, TYPE_CURSOR);
+}
+
+void
+FreeCurIconObject(
+ _In_ PVOID Object)
{
PCURICON_OBJECT CurIcon = Object;
@@ -220,7 +232,8 @@
}
}
- return TRUE;
+ /* Finally free the thing */
+ FreeProcMarkObject(CurIcon);
}
VOID FASTCALL
Modified: trunk/reactos/win32ss/user/ntuser/defwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/defwnd…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/defwnd.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/defwnd.c [iso-8859-1] Tue Oct 21 19:57:03 2014
@@ -675,13 +675,17 @@
{
UserShowCursor( FALSE );
#ifdef NEW_CURSORICON
- UserSetCursor(OldCursor, FALSE);
+ OldCursor = UserSetCursor(OldCursor, FALSE);
#else
IntSetCursor( hOldCursor );
#endif
}
#ifdef NEW_CURSORICON
- UserDereferenceObject(DragCursor);
+ /* It could be that the cursor was already changed while we were proceeding,
+ * so we must unreference whatever cursor was current at the time we restored the
old one.
+ * Maybe it is DragCursor, but maybe it is another one and DragCursor got already
freed.
+ */
+ UserDereferenceObject(OldCursor);
#else
IntDestroyCursor( hDragCursor, FALSE );
#endif
Modified: trunk/reactos/win32ss/user/ntuser/desktop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/deskto…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] Tue Oct 21 19:57:03 2014
@@ -662,9 +662,15 @@
{
return TRUE;
}
+#ifdef NEW_CURSORICON
+ pcurNew->CURSORF_flags |= CURSORF_CURRENT;
+#endif
pcurOld = UserSetCursor(pcurNew, FALSE);
if (pcurOld)
{
+#ifdef NEW_CURSORICON
+ pcurOld->CURSORF_flags &= ~CURSORF_CURRENT;
+#endif
UserDereferenceObject(pcurOld);
}
return TRUE;
Modified: trunk/reactos/win32ss/user/ntuser/display.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/displa…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/display.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/display.c [iso-8859-1] Tue Oct 21 19:57:03 2014
@@ -761,7 +761,8 @@
ulResult = PDEVOBJ_bSwitchMode(ppdev, pdm);
/* Restore mouse pointer, no hooks called */
- UserSetCursor(pvOldCursor, TRUE);
+ pvOldCursor = UserSetCursor(pvOldCursor, TRUE);
+ ASSERT(pvOldCursor == NULL);
/* Check for failure */
if (!ulResult)
Modified: trunk/reactos/win32ss/user/ntuser/object.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/object…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/object.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/object.c [iso-8859-1] Tue Oct 21 19:57:03 2014
@@ -168,7 +168,7 @@
return ObjHead;
}
-static void FreeProcMarkObject(
+void FreeProcMarkObject(
_In_ PVOID Object)
{
PPROCESSINFO ppi = ((PPROCMARKHEAD)Object)->ppi;
@@ -221,7 +221,7 @@
#ifndef NEW_CURSORICON
{ AllocProcMarkObject, /*UserCursorCleanup*/NULL, FreeProcMarkObject }, /*
TYPE_CURSOR */
#else
- { AllocProcMarkObject, IntDestroyCurIconObject, FreeProcMarkObject }, /*
TYPE_CURSOR */
+ { AllocProcMarkObject, IntDestroyCurIconObject, FreeCurIconObject }, /*
TYPE_CURSOR */
#endif
{ AllocSysObject, /*UserSetWindowPosCleanup*/NULL, FreeSysObject }, /*
TYPE_SETWINDOWPOS */
{ AllocDeskThreadObject, IntRemoveHook, FreeDeskThreadObject }, /*
TYPE_HOOK */
Modified: trunk/reactos/win32ss/user/ntuser/object.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/object…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/object.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/object.h [iso-8859-1] Tue Oct 21 19:57:03 2014
@@ -56,4 +56,6 @@
UserDereferenceObject(obj);
}
+void FreeProcMarkObject(_In_ PVOID Object);
+
/* EOF */