summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-04 14:11:24 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-01-21 11:56:55 +0000
commit7b422cce4ebc291d5eff723dc0fd4497ab412ed5 (patch)
tree1e2783fa55719c7c10e5d9073dbbba2d3cb4edd8 /vcl
parentd0bb14ca73d53f2ecb110b6256c5c7f180f3a8f3 (diff)
gtk3: avoid empty target clipboard warning
Change-Id: Ic6b46eb2c81398f0ab2e7539e5cdb27a508c8893 (cherry picked from commit 66fedc0966ad0c732cada974ea910d7a98beca15)
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 9f15db02aa13..e9210d0e128b 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;
}