[PATCH 0/2] MR157: win32u/clipboard: Set bitmap and palette as system object.

Huw Davies (@huw) wine at gitlab.winehq.org
Wed Jun 1 07:44:10 CDT 2022


Huw Davies (@huw) commented about dlls/user32/tests/clipboard.c:
>      ok( r, "gle %ld\n", GetLastError() );
>  
> +    r = open_clipboard( hwnd );
> +    ok( r, "Open clipboard failed: %#lx.\n", GetLastError() );
> +    r = EmptyClipboard();
> +    ok( r, "EmptyClipboard failed: %#lx.\n", GetLastError() );
> +
> +    bitmap = CreateBitmap( 10, 10, 1, 1, NULL );
> +    h = SetClipboardData( CF_BITMAP, bitmap );
> +    ok( h == bitmap, "Expected bitmap %p, got %p.\n", bitmap, h );
> +    ok( !!DeleteObject( bitmap ), "DeleteObject failed.\n" );
> +    h = GetClipboardData( CF_BITMAP );
> +    ok( h == bitmap, "Expected bitmap %p, got %p.\n", bitmap, h );
> +    memset( &bmi, 0, sizeof(bmi) );
> +    bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
> +    result = GetDIBits( GetDC( 0 ), h, 0, 0, NULL, &bmi, 0 );
You're leaking a dc here.  It's probably better to call `GetDC()` at the start of the function and `ReleaseDC()` at the end.

-- 
https://gitlab.winehq.org/wine/wine/-/merge_requests/157#note_1456



More information about the wine-devel mailing list