Skip to content

gdkclipboard-win32.c: Fix call to gdk_clipboard_claim_remote() (check GdkContentFormat is not NULL

Chun-wei Fan requested to merge fix-win32-empty-clipboard into main

Hi,

From the commit message:

The call to gdk_win32_clipboard_request_contentformats() can return NULL even without an error condition being hit (such as when the system clipboard is empty), so check whether the returned GdkContentFormat pointer is not NULL before calling gdk_clipboard_claim_remote(), which expects it to be not NULL, otherwise we face a warning from that funtion and the subsequent g_object_unref().

Additionally, I think even in an error condition, we don't need to show multiple errors that stem from the same cause when a Windows API call failed.

At least partially fixes issue #4796 (closed).

With blessings, thank you!

Edited by Chun-wei Fan

Merge request reports