summaryrefslogtreecommitdiff
path: root/mozilla-1631061-2.patch
diff options
context:
space:
mode:
authorMartin Stransky <stransky@redhat.com>2021-01-30 15:21:26 +0100
committerMartin Stransky <stransky@redhat.com>2021-01-30 15:21:26 +0100
commitd0cb142ca3f7bcbb9a7a5c689a4815b8aa026232 (patch)
treee6899a4f2672bf170bb688cdceeb90532c96d6cf /mozilla-1631061-2.patch
parentMerge branch 'master' into f33 (diff)
parentARM / Rawhide PGO updates to produce rahide build (diff)
downloadlibrewolf-fedora-ff-d0cb142ca3f7bcbb9a7a5c689a4815b8aa026232.tar.gz
librewolf-fedora-ff-d0cb142ca3f7bcbb9a7a5c689a4815b8aa026232.tar.bz2
librewolf-fedora-ff-d0cb142ca3f7bcbb9a7a5c689a4815b8aa026232.zip
Merge branch 'master' into f33
Diffstat (limited to 'mozilla-1631061-2.patch')
-rw-r--r--mozilla-1631061-2.patch91
1 files changed, 91 insertions, 0 deletions
diff --git a/mozilla-1631061-2.patch b/mozilla-1631061-2.patch
new file mode 100644
index 0000000..ae90baa
--- /dev/null
+++ b/mozilla-1631061-2.patch
@@ -0,0 +1,91 @@
+changeset: 567293:4d5e5e9f146e
+tag: tip
+parent: 567291:3bdf0c33844f
+user: stransky <stransky@redhat.com>
+date: Fri Jan 29 12:13:15 2021 +0100
+files: widget/gtk/nsClipboardWayland.cpp
+description:
+Bug 1631061 [Wayland] Clear clipboard content when gtk_clipboard_request_contents() fails, r?jhorak
+
+Differential Revision: https://phabricator.services.mozilla.com/D103461
+
+
+diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp
+--- a/widget/gtk/nsClipboardWayland.cpp
++++ b/widget/gtk/nsClipboardWayland.cpp
+@@ -842,7 +842,8 @@ struct FastTrackClipboard {
+
+ static void wayland_clipboard_contents_received(
+ GtkClipboard* clipboard, GtkSelectionData* selection_data, gpointer data) {
+- LOGCLIP(("wayland_clipboard_contents_received() callback\n"));
++ LOGCLIP(("wayland_clipboard_contents_received() selection_data = %p\n",
++ selection_data));
+ FastTrackClipboard* fastTrack = static_cast<FastTrackClipboard*>(data);
+ fastTrack->mRetrievalContex->TransferFastTrackClipboard(
+ fastTrack->mClipboardRequestNumber, selection_data);
+@@ -851,24 +852,34 @@ static void wayland_clipboard_contents_r
+
+ void nsRetrievalContextWayland::TransferFastTrackClipboard(
+ int aClipboardRequestNumber, GtkSelectionData* aSelectionData) {
+- LOGCLIP(("nsRetrievalContextWayland::TransferFastTrackClipboard()\n"));
++ LOGCLIP(
++ ("nsRetrievalContextWayland::TransferFastTrackClipboard(), "
++ "aSelectionData = %p\n",
++ aSelectionData));
++
++ int dataLength = gtk_selection_data_get_length(aSelectionData);
++ if (dataLength < 0) {
++ LOGCLIP(
++ (" gtk_clipboard_request_contents() failed to get clipboard "
++ "data!\n"));
++ ReleaseClipboardData(mClipboardData);
++ return;
++ }
+
+ if (mClipboardRequestNumber == aClipboardRequestNumber) {
+ LOGCLIP((" request number matches\n"));
+- int dataLength = gtk_selection_data_get_length(aSelectionData);
+- if (!dataLength) {
+- LOGCLIP(
+- (" gtk_selection_data_get_length() returned 0 data length!\n"));
+- return;
+- }
+ LOGCLIP((" fastracking %d bytes of data.\n", dataLength));
+ mClipboardDataLength = dataLength;
+- mClipboardData = reinterpret_cast<char*>(
+- g_malloc(sizeof(char) * (mClipboardDataLength + 1)));
+- memcpy(mClipboardData, gtk_selection_data_get_data(aSelectionData),
+- sizeof(char) * mClipboardDataLength);
+- mClipboardData[mClipboardDataLength] = '\0';
+- LOGCLIP((" done, mClipboardData = %p\n", mClipboardData));
++ if (dataLength > 0) {
++ mClipboardData = reinterpret_cast<char*>(
++ g_malloc(sizeof(char) * (mClipboardDataLength + 1)));
++ memcpy(mClipboardData, gtk_selection_data_get_data(aSelectionData),
++ sizeof(char) * mClipboardDataLength);
++ mClipboardData[mClipboardDataLength] = '\0';
++ LOGCLIP((" done, mClipboardData = %p\n", mClipboardData));
++ } else {
++ ReleaseClipboardData(mClipboardData);
++ }
+ } else {
+ LOGCLIP((" request number does not match!\n"));
+ NS_WARNING("Received obsoleted clipboard data!");
+@@ -952,11 +963,10 @@ void nsRetrievalContextWayland::ReleaseC
+ const char* aClipboardData) {
+ LOGCLIP(("nsRetrievalContextWayland::ReleaseClipboardData [%p]\n",
+ aClipboardData));
+-
+- NS_ASSERTION(aClipboardData == mClipboardData,
+- "Releasing unknown clipboard data!");
+- g_free((void*)aClipboardData);
+-
++ if (aClipboardData != mClipboardData) {
++ NS_WARNING("Wayland clipboard: Releasing unknown clipboard data!");
++ }
++ g_free((void*)mClipboardData);
++ mClipboardDataLength = 0;
+ mClipboardData = nullptr;
+- mClipboardDataLength = 0;
+ }
+
bgstack15