Bug 158947 - Pasting clipboard contents is not possible under certain circumstances with Wayland
Summary: Pasting clipboard contents is not possible under certain circumstances with W...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.5.2.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Michael Weghorn
URL:
Whiteboard: target:24.8.0 target:24.2.2 target:7.6.6
Keywords:
Depends on:
Blocks: Wayland KDE, KF5 Clipboard
  Show dependency treegraph
 
Reported: 2023-12-31 14:41 UTC by fin-w
Modified: 2024-02-22 10:22 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fin-w 2023-12-31 14:41:06 UTC
Description:
Selecting and copying text in LO Writer BEFORE trying to copy text into LO Writer from somewhere else, results in the original LO selected text being copied into the clipboard, deletion of the selected text from LO Writer, and an error saying the clipboard format is not available. This is reproducible in Safe Mode.

Steps to Reproduce:
Using KDE Plasma (5.27.9) with Wayland i.e. KWin on Debian (Trixie)
1. Open LO Writer (7.6.4~rc1-1+b2)
2. Open (for example) Firefox (115.6.0esr-1)
3. Select and copy text in LO, leaving the text selected
4. Alt+Tab away into Firefox
5. Copy some text in Firefox
6. Alt+Tab back into LO, where the original text is still selected
7a. Try to paste, OR
7b. Click in LO Writer to deselect text, select some text again, then try to paste

Actual Results:
The selected text gets deleted (perhaps due to pasting nothing over the selected text, rather than pasting the text in clipboard?) and the original text that was selected in LO is copied into clipboard. An error message shows saying the clipboard format is not available.

Expected Results:
The text in the clipboard should be pasted over (replace) the selected text in LO Writer.


Reproducible: Always


User Profile Reset: No

Additional Info:
This is reproducible in Safe Mode.
The problem occurs when pasting from places other than Firefox (Konsole, Mousepad, Kate etc). In these cases the behaviour is the same.
I don't have this problem in LO Calc.
Deselecting the text in LO Writer before pasting works fine and pastes the clipboard.
Copying between LO Writer and Calc always works fine.

Using Ctrl+Shift+V and selecting paste unformatted, doesn't work REGARDLESS of whether text is selected and copied in LO Writer. This seems similar / same behaviour as here https://bugs.documentfoundation.org/show_bug.cgi?id=156562  and here https://bugs.documentfoundation.org/show_bug.cgi?id=157373

Discussion of related problem in KDE bug tracker: https://bugs.kde.org/show_bug.cgi?id=470334

These problems existed in LO version 7.5.2.2 installed from the website download, I have updated to LO 7.6.4.1 from the repo and the problem persists.


Help → About LibreOffice:
Version: 7.6.4.1 (X86_64) / LibreOffice Community
Build ID: 60(Build:1)
CPU threads: 4; OS: Linux 6.5; UI render: default; VCL: kf5 (cairo+wayland)
Locale: cy-GB (en_GB.UTF-8); UI: en-US
Debian package version: 4:7.6.4~rc1-1+b2
Calc: threaded
Comment 1 Stéphane Guillou (stragu) 2024-02-01 15:50:33 UTC
Reproduced in:

Version: 7.6.4.1 (X86_64) / LibreOffice Community
Build ID: e19e193f88cd6c0525a17fb7a176ed8e6a3e2aa1
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+wayland)
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Not reproduced with kf5 (cairo+xcb). nor gtk3.
Comment 2 Michael Weghorn 2024-02-09 20:26:26 UTC
Thanks a lot for the excellent bug description that allows to reproduce this reliably.

Pending Gerrit change:
https://gerrit.libreoffice.org/c/core/+/163202
Comment 3 fin-w 2024-02-09 20:44:19 UTC
No worries, and thanks for fixing! This has been frustrating me for a while now.
Comment 4 Commit Notification 2024-02-10 08:16:54 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/cb9513c74502144a480494e0c6a32ac6173ae0a3

tdf#158947 sw: Don't unrelatedly overwrite system clipboard on paste

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2024-02-12 11:14:30 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/0750cacbb165b733ab76bb54a6c0116e8266a01f

tdf#158947 sw: Don't unrelatedly overwrite system clipboard on paste

It will be available in 24.2.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 fin-w 2024-02-13 17:43:39 UTC
I can confirm this bug has been fixed! I just tried the dev version of LibreOffice. Thanks again.
Comment 7 Michael Weghorn 2024-02-13 21:06:31 UTC
(In reply to fin-w from comment #6)
> I can confirm this bug has been fixed! I just tried the dev version of
> LibreOffice. Thanks again.

Thanks for testing!
Comment 8 Commit Notification 2024-02-22 10:22:15 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/7f8f7f36ebc2c43f209b49ff093c4eb65948bd86

tdf#158947 sw: Don't unrelatedly overwrite system clipboard on paste

It will be available in 7.6.6.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.