summaryrefslogtreecommitdiff
path: root/mozilla-1460810.patch
blob: 016f75fda440462688fa24aab59624e98b7bd16e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# HG changeset patch
# User Evan Klitzke <evan@eklitzke.org>
# Parent  c5e0ee17388381f96d0acf4bdd9d163827719096
Bug 1460810 - [Gtk/Wayland] Handle error value (-1) returned by gtk_section_data_get_length(), r=stransky

diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp
--- a/widget/gtk/nsClipboardWayland.cpp
+++ b/widget/gtk/nsClipboardWayland.cpp
@@ -662,18 +662,19 @@ wayland_clipboard_contents_received(GtkC
     delete fastTrack;
 }
 
 void
 nsRetrievalContextWayland::TransferFastTrackClipboard(
     int aClipboardRequestNumber, GtkSelectionData *aSelectionData)
 {
     if (mClipboardRequestNumber == aClipboardRequestNumber) {
-        mClipboardDataLength = gtk_selection_data_get_length(aSelectionData);
-        if (mClipboardDataLength > 0) {
+        int dataLength = gtk_selection_data_get_length(aSelectionData);
+        if (dataLength > 0) {
+            mClipboardDataLength = dataLength;
             mClipboardData = reinterpret_cast<char*>(
                 g_malloc(sizeof(char)*mClipboardDataLength));
             memcpy(mClipboardData, gtk_selection_data_get_data(aSelectionData),
                    sizeof(char)*mClipboardDataLength);
         }
     } else {
         NS_WARNING("Received obsoleted clipboard data!");
     }
bgstack15