Bug 487843 - Always saving text in clipboard history causes crash
Summary: Always saving text in clipboard history causes crash
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Clipboard widget & pop-up (show other bugs)
Version: git-stable-Plasma/6.1
Platform: Arch Linux Linux
: NOR crash
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
: 487575 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-05-31 16:47 UTC by trunksm.wrk
Modified: 2024-06-11 14:27 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.1
Sentry Crash Report:


Attachments
Crash dump without debug symbols regarding plasmashell clipboard (15.11 KB, text/vnd.kde.kcrash-report)
2024-05-31 16:47 UTC, trunksm.wrk
Details
X11 Crash attempt with debug symbols with Lorem Ipsum test (37.84 KB, text/plain)
2024-06-02 11:48 UTC, trunksm.wrk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description trunksm.wrk 2024-05-31 16:47:00 UTC
Created attachment 170019 [details]
Crash dump without debug symbols regarding plasmashell clipboard

SUMMARY
Using KDE Plasma 6.1 Beta on Wayland, plasmashell would 'occasionally' crash on me. Took me a while to investigate to find out it's the clipboard component that's crashing and is remedied by undoing tweaks. X11 not affected.

STEPS TO REPRODUCE
1. Use KDE Plasma Wayland.
2. Open Clipboard Configuration.
3. Enable [Keep the selection and clipboard the same] from "Selection and Clipboard"; & select [Always save in history] for "Text selection".
4. Run `plasmawindowed org.kde.plasma.clipboard` as this weirdly guarantees the crash for me if plasmashell doesn't.
5. Rapidly select text from any source. Repeat until crash either immediately or a few seconds after.

OBSERVED RESULT
Plasmashell with Wayland freezes and creates a crash dump which clues to clipboard involvement.
Plasmawindowed also prints out a line of code that reportedly failed.

EXPECTED RESULT
No crashes and oddities.

SOFTWARE/OS VERSIONS
Operating System: EndeavourOS / Arch Linux
KDE Gear Version: 24.05.0-1
KDE Plasma Version: 6.0.90-1
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.1
Kernel Version: 6.9.2-arch1-1
Graphics Platform: Wayland

ADDITIONAL INFORMATION
Currently using both 'kde-unstable' and 'extra-testing' Arch repo for Plasma 6.1 Beta.
Reproducing the crash on X11 does not work which may mean only Wayland is affected.
Attached DrKonqi report, but without debug symbols as it stresses my low-end system and fails.
Unsure if this is related to bug 469663, but this does not involve URLs and pop-up menus.

Lastly, the printed line upon interacting with the clipboard launched with `plasmawindowed`:
```
kf.plasma.quick: Applet preload policy set to 1
qml: 0
DataControlOffer: timeout reading from pipe
DataControlOffer: timeout reading from pipe
/usr/include/c++/14.1.1/bits/shared_ptr_base.h:1350: std::__shared_ptr_access<_Tp, _Lp, <anonymous>, <anonymous> >::element_type& std::__shared_ptr_access<_Tp, _Lp, <anonymous>, <anonymous> >::operator*() const [with _Tp = HistoryItem; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic; bool <anonymous> = false; bool <anonymous> = false; element_type = HistoryItem]: Assertion '_M_get() != nullptr' failed.
Aborted (core dumped)
```
Comment 1 Podagric 2024-06-02 01:48:11 UTC
I can reproduce it in xorg too. 

Operating System: Arch Linux 
KDE Plasma Version: 6.0.90
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.1
Comment 2 Podagric 2024-06-02 02:00:36 UTC
it was happening to me after copying code generated by chatgpt from firefox. regular texts don't seem to generate this crash. And copying exactly the same code via chromium was no problem at all

I don't know if this log is of any use, but here it is: https://pastebin.com/7t2N11u3

And the code I copied from firefox: https://pastebin.com/qdcPAPFs
Comment 3 trunksm.wrk 2024-06-02 11:48:41 UTC
Created attachment 170062 [details]
X11 Crash attempt with debug symbols with Lorem Ipsum test
Comment 4 trunksm.wrk 2024-06-02 11:51:57 UTC
Tried to see if regular text causes a crash with the "Lorem ipsum" page on the Internet and on a text file opened with Kate.
Also tried to give Xorg/X11 another shot along with my usual Wayland session.

Tried to test with Firefox, Kate, and Konsole. So far, I have no definitive find on whether apps matter as I inconsistently crash with each of them with or without clearing history. Additionally, am unable to know what character or phrase breaks the clipboard. Spaces, alphabet, and newlines seems to crash it. I am unsure if copy length does anything, but was able to crash with seemingly empty entries and two newlines entries.

However, I was able to do additional crashes. On Wayland, I could easily produce one frequently and had to clear history to prevent perpetual crashing (though, am unable to easily reproduce perpetual crashes).

For X11, I have difficulty creating one, but I have done a crash and captured logs via gdb with debug symbols for `plasmashell` with `plasmawindowed` running org.kde.plasma.clipboard. The file has been attached just before this comment.
Comment 5 trunksm.wrk 2024-06-02 11:57:58 UTC
I apologize if I'm posting too frequently in a short timespan. I forgot to include that when I cannot cause an immediate crash for some circumstances, this printed line frequently pops up upon interacting with the clipboard window:

```
file:///usr/share/plasma/plasmoids/org.kde.plasma.clipboard/contents/ui/TextItemDelegate.qml:20: TypeError: Cannot read property 'slice' of undefined
```

That should be most of I can find at this time and am unsure if I can investigate this differently other than generating more logs.
Comment 6 Bug Janitor Service 2024-06-03 01:35:19 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4395
Comment 7 Bug Janitor Service 2024-06-03 01:35:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4395
Comment 8 Fushan Wen 2024-06-03 04:25:56 UTC
Git commit a9c4dc860b64c4cc7f7e60378f6ec6c5de889a24 by Fushan Wen.
Committed on 03/06/2024 at 01:33.
Pushed by fusionfuture into branch 'master'.

klipper: guard against empty selection event
FIXED-IN: 6.1

M  +2    -2    klipper/klipper.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/a9c4dc860b64c4cc7f7e60378f6ec6c5de889a24
Comment 9 Fushan Wen 2024-06-03 04:44:38 UTC
Git commit 40961983eb485fefe390c8c084c23e263f6877f4 by Fushan Wen.
Committed on 03/06/2024 at 04:26.
Pushed by fusionfuture into branch 'Plasma/6.1'.

klipper: guard against empty selection event
FIXED-IN: 6.1


(cherry picked from commit a9c4dc860b64c4cc7f7e60378f6ec6c5de889a24)

Co-authored-by: Fushan Wen <qydwhotmail@gmail.com>

M  +2    -2    klipper/klipper.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/40961983eb485fefe390c8c084c23e263f6877f4
Comment 10 Bug Janitor Service 2024-06-03 16:50:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4401
Comment 11 Bug Janitor Service 2024-06-03 16:50:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4401
Comment 12 Fushan Wen 2024-06-04 11:27:17 UTC
Git commit 2796e85d0e4e98ab0345890d3c58847ea26c22f6 by Fushan Wen.
Committed on 04/06/2024 at 11:07.
Pushed by fusionfuture into branch 'master'.

appiumtests: test empty clip crashes klipper
Related: bug 466414

M  +1    -1    appiumtests/applets/CMakeLists.txt
M  +43   -2    appiumtests/applets/clipboardtest.py

https://invent.kde.org/plasma/plasma-workspace/-/commit/2796e85d0e4e98ab0345890d3c58847ea26c22f6
Comment 13 Bug Janitor Service 2024-06-04 11:41:31 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4407
Comment 14 Fushan Wen 2024-06-04 12:02:27 UTC
Git commit eb016cf60c9aaf37b9faf65b52abe51b4dd85eb0 by Fushan Wen.
Committed on 04/06/2024 at 11:41.
Pushed by fusionfuture into branch 'Plasma/6.1'.

appiumtests: test empty clip crashes klipper
Related: bug 466414


(cherry picked from commit 2796e85d0e4e98ab0345890d3c58847ea26c22f6)

Co-authored-by: Fushan Wen <qydwhotmail@gmail.com>

M  +1    -1    appiumtests/applets/CMakeLists.txt
M  +43   -2    appiumtests/applets/clipboardtest.py

https://invent.kde.org/plasma/plasma-workspace/-/commit/eb016cf60c9aaf37b9faf65b52abe51b4dd85eb0
Comment 15 Fushan Wen 2024-06-11 13:26:33 UTC
*** Bug 487575 has been marked as a duplicate of this bug. ***