bug 546387 - Don't try to set the GTK clipboard with null items r=karlt
authorChris H-C <chutten@mozilla.com>
Fri, 26 May 2017 11:50:13 -0400
changeset 410648 ce3003cd38bcca606b1019b380bb985809c99bd0
parent 410647 f94e7abdc7d58a867a449b06ed59ba33d484da7d
child 410649 1a313acd411064962b235f0ef48d018f9b16f06b
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs546387
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 546387 - Don't try to set the GTK clipboard with null items r=karlt It causes an assert failure in gtk which prints to the console. MozReview-Commit-ID: A4106Z4rT36
widget/gtk/nsClipboard.cpp
--- a/widget/gtk/nsClipboard.cpp
+++ b/widget/gtk/nsClipboard.cpp
@@ -241,17 +241,18 @@ nsClipboard::SetData(nsITransferable *aT
     
     // Get GTK clipboard (CLIPBOARD or PRIMARY)
     GtkClipboard *gtkClipboard = gtk_clipboard_get(GetSelectionAtom(aWhichClipboard));
   
     gint numTargets;
     GtkTargetEntry *gtkTargets = gtk_target_table_new_from_list(list, &numTargets);
           
     // Set getcallback and request to store data after an application exit
-    if (gtk_clipboard_set_with_data(gtkClipboard, gtkTargets, numTargets, 
+    if (gtkTargets &&
+        gtk_clipboard_set_with_data(gtkClipboard, gtkTargets, numTargets,
                                     clipboard_get_cb, clipboard_clear_cb, this))
     {
         // We managed to set-up the clipboard so update internal state
         // We have to set it now because gtk_clipboard_set_with_data() calls clipboard_clear_cb()
         // which reset our internal state 
         if (aWhichClipboard == kSelectionClipboard) {
             mSelectionOwner = aOwner;
             mSelectionTransferable = aTransferable;