Title: [173692] trunk/Source/WebCore
Revision
173692
Author
[email protected]
Date
2014-09-17 09:12:50 -0700 (Wed, 17 Sep 2014)

Log Message

[GTK] Fix runtime critical warnings when writing to the clipboard after r173687
https://bugs.webkit.org/show_bug.cgi?id=136891

Reviewed by Philippe Normand.

* platform/gtk/PasteboardHelper.cpp:
(WebCore::PasteboardHelper::writeClipboardContents): Check passed
callback is not null before trying to ref/unref it since
g_closure_ref/unref are not null safe.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (173691 => 173692)


--- trunk/Source/WebCore/ChangeLog	2014-09-17 16:11:12 UTC (rev 173691)
+++ trunk/Source/WebCore/ChangeLog	2014-09-17 16:12:50 UTC (rev 173692)
@@ -1,3 +1,15 @@
+2014-09-17  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Fix runtime critical warnings when writing to the clipboard after r173687
+        https://bugs.webkit.org/show_bug.cgi?id=136891
+
+        Reviewed by Philippe Normand.
+
+        * platform/gtk/PasteboardHelper.cpp:
+        (WebCore::PasteboardHelper::writeClipboardContents): Check passed
+        callback is not null before trying to ref/unref it since
+        g_closure_ref/unref are not null safe.
+
 2014-09-17  Zan Dobersek  <[email protected]>
 
         [GTK] Add a helper function for display system deduction

Modified: trunk/Source/WebCore/platform/gtk/PasteboardHelper.cpp (173691 => 173692)


--- trunk/Source/WebCore/platform/gtk/PasteboardHelper.cpp	2014-09-17 16:11:12 UTC (rev 173691)
+++ trunk/Source/WebCore/platform/gtk/PasteboardHelper.cpp	2014-09-17 16:12:50 UTC (rev 173692)
@@ -311,11 +311,12 @@
     if (numberOfTargets > 0 && table) {
         settingClipboardDataObject = dataObject;
 
-        if (gtk_clipboard_set_with_data(clipboard, table, numberOfTargets, getClipboardContentsCallback, clearClipboardContentsCallback, g_closure_ref(callback)))
+        if (gtk_clipboard_set_with_data(clipboard, table, numberOfTargets, getClipboardContentsCallback, clearClipboardContentsCallback, callback ? g_closure_ref(callback) : nullptr))
             gtk_clipboard_set_can_store(clipboard, nullptr, 0);
         else {
             // When gtk_clipboard_set_with_data fails the callbacks are ignored, so we need to release the reference we were passing to clearClipboardContentsCallback.
-            g_closure_unref(callback);
+            if (callback)
+                g_closure_unref(callback);
         }
 
         settingClipboardDataObject = nullptr;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to