Cursor patches

Robert Shearman rob at codeweavers.com
Fri Jul 7 06:33:22 CDT 2006


H. Verbeet wrote:

> Attached to this mail are a couple of patches that should fix some
> issues with mouse cursors. It would be nice if some people could have
> a look and see if the patches break anything. Patches 1-4 move cursors
> into the server, 5 adds support for Xcursor cursors, 6 & 7 are
> cleanups, 8 fixes loading of .cur cursors, 9 adds support for animated
> cursors and 10 adds support for 32bpp cursors.


Overall, I'm very impressed with the patch set.

However, I did find two things that I think need consideration or 
improvement:

 From 01_server_cursoricon.diff.txt:

> +/* Destroy a cursor */
> +DECL_HANDLER(destroy_cursor)
> +{
> +    unsigned int i;
> +    cursor_t *cursor = free_user_handle( req->handle );
> +
> +    if (!cursor) return;
> +
> +    for (i = 0; i < cursor->num_frames; ++i)
> +    {
> +        if (cursor->frames[i].bits) free( cursor->frames[i].bits );
> +    }
> +
> +    free( cursor->frames );
> +}


This appears to be the only place where a cursor is destroyed. Thus, a 
bad application could end up wineserver to leak memory. I think you need 
to investigate when Windows frees cursors that have not had 
DestroyCursor called on them. My guess is that it frees them on process 
destruction.


 From 09_user_ani_cursor.diff.txt:

> --- a/dlls/user/Makefile.in
> +++ b/dlls/user/Makefile.in
> @@ -6,7 +6,7 @@ VPATH     = @srcdir@
>  MODULE    = user32.dll
>  IMPORTLIB = libuser32.$(IMPLIBEXT)
>  IMPORTS   = gdi32 advapi32 kernel32 ntdll
> -DELAYIMPORTS = imm32
> +DELAYIMPORTS = imm32 winmm
>  EXTRALIBS = $(LIBUNICODE)
>  
>  SPEC_SRCS16 = \


I'm not sure it is acceptable to import winmm from user32, even if it is 
a delay import.

-- 
Rob Shearman




More information about the wine-devel mailing list