From 7b422cce4ebc291d5eff723dc0fd4497ab412ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 4 Dec 2015 14:11:24 +0000 Subject: [PATCH 1/3] gtk3: avoid empty target clipboard warning Change-Id: Ic6b46eb2c81398f0ab2e7539e5cdb27a508c8893 (cherry picked from commit 66fedc0966ad0c732cada974ea910d7a98beca15) --- vcl/unx/gtk3/gtk3gtkinst.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 9f15db0..e9210d0 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -572,13 +572,16 @@ void VclGtkClipboard::setContents( aGtkTargets.push_back(makeGtkTargetEntry(aFlavor)); } - //if there was a previous gtk_clipboard_set_with_data call then - //ClipboardClearFunc will be called now - GtkClipboard* clipboard = gtk_clipboard_get(m_nSelection); - //use with_owner with m_pOwner so we can distinguish in handle_owner_change - //if we have gained or lost ownership of the clipboard - gtk_clipboard_set_with_owner(clipboard, aGtkTargets.data(), aGtkTargets.size(), - ClipboardGetFunc, ClipboardClearFunc, G_OBJECT(m_pOwner)); + if (!aGtkTargets.empty()) + { + //if there was a previous gtk_clipboard_set_with_data call then + //ClipboardClearFunc will be called now + GtkClipboard* clipboard = gtk_clipboard_get(m_nSelection); + //use with_owner with m_pOwner so we can distinguish in handle_owner_change + //if we have gained or lost ownership of the clipboard + gtk_clipboard_set_with_owner(clipboard, aGtkTargets.data(), aGtkTargets.size(), + ClipboardGetFunc, ClipboardClearFunc, G_OBJECT(m_pOwner)); + } m_aGtkTargets = aGtkTargets; } -- 2.5.0