[2/2] user32: Also release GMEM_FIXED data in free_cached_data.

Sebastian Lackner sebastian at fds-team.de
Thu Sep 29 20:44:37 CDT 2016


Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---

I assume the purpose of the check was to detect GMEM_MOVEABLE handles, in order to mimic
WinXP/Win2003 behavior for SetClipboardData. Unfortunately, the cache implemented in
GetClipboardData() also uses GMEM_FIXED, which means even sane apps will leak memory
on each cache flush.

Tests suggest that Windows Vista+ also release GMEM_FIXED pointers passed to
SetClipboardData, so there is probably no need to keep this hack. Alternatively, it will
be necessary to modify GetClipboardData() to work with GMEM_MOVEABLE handles.
(see https://newtestbot.winehq.org/JobDetails.pl?Key=25966&log_201=1#k201)

 dlls/user32/clipboard.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c
index 0d48984..d33459c 100644
--- a/dlls/user32/clipboard.c
+++ b/dlls/user32/clipboard.c
@@ -326,11 +326,7 @@ static void free_cached_data( struct cached_format *cache )
         GlobalFree( cache->handle );
         break;
     default:
-        if ((ptr = GlobalLock( cache->handle )) && ptr != cache->handle)
-        {
-            GlobalUnlock( cache->handle );
-            GlobalFree( cache->handle );
-        }
+        GlobalFree( cache->handle );
         break;
     }
     list_remove( &cache->entry );
-- 
2.9.0



More information about the wine-patches mailing list