forked from AuroraMiddleware/gtk
gdkclipboard-win32.c: Fix call to gdk_clipboard_claim_remote()
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(). This at least partially fixes issue #4796.
This commit is contained in:
parent
3b50f2e8b9
commit
edd8d55b42
@ -142,10 +142,14 @@ gdk_win32_clipboard_claim_remote (GdkWin32Clipboard *cb)
|
|||||||
cb->sequence_number = -1;
|
cb->sequence_number = -1;
|
||||||
|
|
||||||
formats = gdk_win32_clipboard_request_contentformats (cb);
|
formats = gdk_win32_clipboard_request_contentformats (cb);
|
||||||
|
|
||||||
|
if (formats != NULL)
|
||||||
|
{
|
||||||
gdk_clipboard_claim_remote (GDK_CLIPBOARD (cb), formats);
|
gdk_clipboard_claim_remote (GDK_CLIPBOARD (cb), formats);
|
||||||
gdk_content_formats_unref (formats);
|
gdk_content_formats_unref (formats);
|
||||||
cb->sequence_number = GetClipboardSequenceNumber ();
|
cb->sequence_number = GetClipboardSequenceNumber ();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_win32_clipboard_finalize (GObject *object)
|
gdk_win32_clipboard_finalize (GObject *object)
|
||||||
|
Loading…
Reference in New Issue
Block a user