Closed Bug 1649579 Opened 4 years ago Closed 1 year ago

Clipboard intermittent clear bug when closing firefox

Categories

(Core :: Widget: Gtk, defect, P3)

80 Branch
x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
119 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox77 --- wontfix
firefox80 --- wontfix
firefox88 --- wontfix
firefox94 --- wontfix
firefox95 --- wontfix
firefox96 --- wontfix
firefox119 --- verified

People

(Reporter: u373683, Assigned: edgar)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0

Steps to reproduce:

Reboot computer to a fresh OS and Firefox process.

Open Firefox & close Firefox number of times loading the same web page each time.

Each time copy CTRL+C from web page once each time any random page text, and while Firefox is still open, check paste CTRL+V.

Each time close Firefox and check paste CTRL+V.

OS:
Fedora 32 Linux using XWayland (fully updated)

Tests:
Checked safe mode: same problem
Disabled privacy clearing on exit: same problem
Standard Enhanced Tracking Protection: same problem
Disabled gnome shell integration addon: same problem

It looks to me like its some issue with the Firefox code that causes clearing of the clipboard when it gets whacked out from something after closing enough times.

Actual results:

Firefox at first allows the clipboard contents to stick around when closed.

Then Firefox starts clearing the clipboard when closed.

Expected results:

Firefox should do the same thing every time (probably keep the clipboard contents).

More tests show its completely random.

Can reboot and Firefox may start to clear clipboard on the first close.

Can reboot and Firefox may start to clear clipboard after 15 closes.

Other applications will keep clipboard when closing even after Firefox stops doing this.

Ah, here we go workaround :-D

When Firefox closing starts to clear contents of clipboard the following fixes it momentarily:

With Firefox open.
Open chrome and load a web page.
Copy CTRL+C some text from open web page in chrome.
Paste CTRL+V in Firefox to test contents of clipboard.
Close chrome.
Close firefox.
Test clipboard by pasting CTRL+V and it should still be there thus re-fixing the problem for a short time.

That should help to narrow down what's going on.

OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Version: 77 Branch → 80 Branch

Probably no one will reply but is there anything better than gdb for debugging Firefox source build like an actual IDE? Something worth using.

Alright, so logging to console for gdb debugging shows the destructor isn't called when it keeps the clipboard contents. When the destuctor is called, it clears the clipboard.

The problem stems from using the destructor and clearing the clipboard.

Just tested without clearing from the destructor and it works fine for me. Firefox exits normally and all is good when the destructor is called and also when it isn't.

This is possibly some crapped up old code today that needs to be refactored. bug https://bugzilla.mozilla.org/show_bug.cgi?id=531580 may no longer be relevant and instead causes a problem. Its 11 years old after all.

Summary: clipboard intermittent clear bug when closing firefox → [SOLVED: destructor clearing issue] clipboard intermittent clear bug when closing firefox
Component: Untriaged → Widget: Gtk
Product: Firefox → Core

Hi,

I was not able to reproduce this issue on Ubuntu 18.

Per comment #4 and status changed to SOLVED, are you still experimenting this issue @esschalm@outlook.com?

Thanks.

Flags: needinfo?(esschalm)
Priority: -- → P3

Bug is present in Firefox 88 too. This is on Ubuntu 20.10, Groovy Gorilla. After I close firefox, sometimes the clipboard is cleared. Sometimes it isn't.
I understand it may be for security reasons that y'all clear the clipboard, but personally, I find it really frustrating when I copy a link from Firefox, close Firefox and then try to paste the link in Google Docs or whereever, but then I realize the clipboard is cleared. Since I always use incognito mode, it often becomes difficult to find the website again, because I neither have it in the browser history nor on the clipboard.
If it's difficult to solve this heisenbug, please just remove the code that clears the clipboard. I'm pretty sure I'm not the only one who needs the copied link to persist after closing Firefox.

Hi, we don't want to clear clipboard when Firefox quits - we actually want to save it and it's done here:
https://searchfox.org/mozilla-central/rev/5359952d8b0be3e706e8c943c2bef2674723b8a9/widget/gtk/nsClipboard.cpp#118

Is the observer fired and gtk_clipboard_store() called?

Setting this to NEW as I can reproduce it on Ubuntu 20.04 x64 using Firefox 91.3.0 esr, Firefox 94.0.1, Firefox 95 beta, and Nightly 96.0a1- the issue is intermittent.

These are the steps that I use:

  1. Copy a text (paste it in the address bar to verify that is copied)
  2. Close FIrefox
  3. Paste the input into a text editor.

Actual results: the text is not pasted, the clipboard is empty.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: [SOLVED: destructor clearing issue] clipboard intermittent clear bug when closing firefox → Clipboard intermittent clear bug when closing firefox

Can you reproduce that with other applications (gedit for instance) or is that a Firefox issue only?
Thanks.

Maybe this information might help:

If I open Firefox on a terminal and close it through the graphical environment, the clearing-on-exit bug happens and I get the following output on the terminal:

###!!! [Parent][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost

If I open Firefox on a terminal, and force-close it with a Ctrl+C on the terminal, I don't get the aforementioned message and the bug does not happen - that is, I can still paste the text I had copied.

(In reply to Martin Stránský [:stransky] (ni? me) from comment #10)

Can you reproduce that with other applications (gedit for instance) or is that a Firefox issue only?
Thanks.

At least for me it only happens with Firefox.

For me it happens every time.
So long I have not found a single way to retain clipboard content after closing firefox.
Not a single proposed solution from this thread has worked for me.
I also tried reinstalling firefox. Did not work.
After copying anything from the firefox window to the clipboard, i can use it as much as I want but only until Firefox gets closed.
After closing it the content of the clipboard disappears every single time.
it happens only with Firefox

Ubuntu 20.04
Firefox 97.0

Clear a needinfo that is pending on an inactive user.

Inactive users most likely will not respond; if the missing information is essential and cannot be collected another way, the bug maybe should be closed as INCOMPLETE.

For more information, please visit auto_nag documentation.

Flags: needinfo?(u373683)
Duplicate of this bug: 1801482
Duplicate of this bug: 1779244
Duplicate of this bug: 1771600

Bug 311340 tried to fix a similar issue, but have to clear clipboard in nsClipboard's
destructor in order to avoid crash while calling gdk_display_close() on exit,
see bug 531580. But after bug 1626536, we are no longer calling gdk_display_close()
on exit, I don't see the same crash as bug 531580 anymore, either.

Assignee: nobody → echen
Status: NEW → ASSIGNED
Pushed by stransky@redhat.com: https://hg.mozilla.org/integration/autoland/rev/2e667a1d42e4 [GTK] Do not clear clipboard data on exit; r=stransky
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 119 Branch
Blocks: gtkclipboard
Duplicate of this bug: 1790282
Duplicate of this bug: 1823674
Flags: qe-verify+

I've reproduced this issue using Nightly 119.0.a1(2023-09-05) version on Ubuntu 22.04 following the STR from Comment 8.
Verified as fixed on the latest Nightly 120.0a1 (2023-10-17) version under same configuration where the issue no longer persists.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: