Alexandre Julliard : user32: Move freeing of a 16-bit module' s icons to user16.c.

Alexandre Julliard julliard at winehq.org
Tue Dec 22 09:58:56 CST 2009


Module: wine
Branch: master
Commit: e3bcc11bebd24fbd804c8cf16eba7d587e2f850a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e3bcc11bebd24fbd804c8cf16eba7d587e2f850a

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Dec 21 18:24:17 2009 +0100

user32: Move freeing of a 16-bit module's icons to user16.c.

---

 dlls/user32/cursoricon.c   |   27 ---------------------------
 dlls/user32/user16.c       |   15 ++++++++++++++-
 dlls/user32/user_private.h |    1 -
 3 files changed, 14 insertions(+), 29 deletions(-)

diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index 0473315..118b8b6 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -447,33 +447,6 @@ static INT CURSORICON_DelSharedIcon( HICON hIcon )
 }
 
 /**********************************************************************
- *	    CURSORICON_FreeModuleIcons
- */
-void CURSORICON_FreeModuleIcons( HMODULE16 hMod16 )
-{
-    ICONCACHE **ptr = &IconAnchor;
-    HMODULE hModule = HMODULE_32(GetExePtr( hMod16 ));
-
-    EnterCriticalSection( &IconCrst );
-
-    while ( *ptr )
-    {
-        if ( (*ptr)->hModule == hModule )
-        {
-            ICONCACHE *freePtr = *ptr;
-            *ptr = freePtr->next;
-
-            GlobalFree16(HICON_16(freePtr->hIcon));
-            HeapFree( GetProcessHeap(), 0, freePtr );
-            continue;
-        }
-        ptr = &(*ptr)->next;
-    }
-
-    LeaveCriticalSection( &IconCrst );
-}
-
-/**********************************************************************
  *              get_icon_size
  */
 BOOL get_icon_size( HICON handle, SIZE *size )
diff --git a/dlls/user32/user16.c b/dlls/user32/user16.c
index 0957ba2..c6fd3d7 100644
--- a/dlls/user32/user16.c
+++ b/dlls/user32/user16.c
@@ -303,6 +303,19 @@ static int release_shared_icon( HICON16 icon )
     return -1;
 }
 
+static void free_module_icons( HINSTANCE16 inst )
+{
+    struct cache_entry *cache, *next;
+
+    LIST_FOR_EACH_ENTRY_SAFE( cache, next, &icon_cache, struct cache_entry, entry )
+    {
+        if (cache->inst != inst) continue;
+        list_remove( &cache->entry );
+        GlobalFree16( cache->icon );
+        HeapFree( GetProcessHeap(), 0, cache );
+    }
+}
+
 
 /**********************************************************************
  *		InitApp (USER.5)
@@ -1516,7 +1529,7 @@ void WINAPI SignalProc16( HANDLE16 hModule, UINT16 code,
     {
         /* HOOK_FreeModuleHooks( hModule ); */
         CLASS_FreeModuleClasses( hModule );
-        CURSORICON_FreeModuleIcons( hModule );
+        free_module_icons( GetExePtr(hModule) );
     }
 }
 
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index fc92f25..41379f0 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -326,7 +326,6 @@ typedef struct
 
 #include "poppack.h"
 
-extern void CURSORICON_FreeModuleIcons( HMODULE16 hModule ) DECLSPEC_HIDDEN;
 extern BOOL get_icon_size( HICON handle, SIZE *size ) DECLSPEC_HIDDEN;
 
 /* Mingw's assert() imports MessageBoxA and gets confused by user32 exporting it */




More information about the wine-cvs mailing list