Author: jimtabor Date: Wed Oct 16 00:11:23 2013 New Revision: 60684
URL: http://svn.reactos.org/svn/reactos?rev=60684&view=rev Log: - Properly remove window properties when destroying the window.
Modified: trunk/reactos/win32ss/user/ntuser/prop.c trunk/reactos/win32ss/user/ntuser/prop.h trunk/reactos/win32ss/user/ntuser/window.c
Modified: trunk/reactos/win32ss/user/ntuser/prop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/prop.c?... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/prop.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/prop.c [iso-8859-1] Wed Oct 16 00:11:23 2013 @@ -16,12 +16,12 @@ { PLIST_ENTRY ListEntry; PPROPERTY Property; + int i;
ListEntry = Window->PropListHead.Flink; - while (ListEntry != &Window->PropListHead) + for (i = 0; i < Window->PropListItems; i++ ) { Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry); - if (!Property) break; if (Property->Atom == Atom) { return(Property); @@ -77,6 +77,25 @@
Prop->Data = Data; return TRUE; +} + +VOID FASTCALL +IntRemoveWindowProp(PWND Window) +{ + PLIST_ENTRY ListEntry; + PPROPERTY Property; + int i, Count = Window->PropListItems; + + ListEntry = Window->PropListHead.Flink; + for (i = 0; i < Count; i++ ) + { + Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry); + ListEntry = ListEntry->Flink; + RemoveEntryList(&Property->PropListEntry); + UserHeapFree(Property); + Window->PropListItems--; + } + return; }
/* FUNCTIONS *****************************************************************/
Modified: trunk/reactos/win32ss/user/ntuser/prop.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/prop.h?... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/prop.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/prop.h [iso-8859-1] Wed Oct 16 00:11:23 2013 @@ -4,3 +4,4 @@ BOOL FASTCALL IntRemoveProp(PWND,ATOM); BOOL FASTCALL IntSetProp(PWND, ATOM, HANDLE); HANDLE FASTCALL UserGetProp(PWND, ATOM); +VOID FASTCALL IntRemoveWindowProp(PWND Window);
Modified: trunk/reactos/win32ss/user/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/window.... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] Wed Oct 16 00:11:23 2013 @@ -426,8 +426,6 @@ PWND Child; PMENU_OBJECT Menu; BOOLEAN BelongsToThreadData; - PLIST_ENTRY ListEntry; - PPROPERTY Property;
ASSERT(Window);
@@ -556,12 +554,11 @@
IntUnlinkWindow(Window);
- ListEntry = Window->PropListHead.Flink; - while (ListEntry != &Window->PropListHead) - { - Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry); - ListEntry = ListEntry->Flink; - IntRemoveProp(Window, Property->Atom); + if (Window->PropListItems) + { + IntRemoveWindowProp(Window); + TRACE("Window->PropListItems %d\n",Window->PropListItems); + ASSERT(Window->PropListItems==0); }
UserReferenceObject(Window);