Bug 456167 - [Wayland] App closes when I select text after disabling middle-click pasting
Summary: [Wayland] App closes when I select text after disabling middle-click pasting
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.25.90
Platform: Arch Linux Linux
: VHI crash
Target Milestone: ---
Assignee: Méven Car
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-30 11:56 UTC by Patrick Silva
Modified: 2022-10-05 07:00 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2022-06-30 11:56:31 UTC
STEPS TO REPRODUCE
1. use Wayland session
2. open Konsole
3. run 'ls'
4. select any word from the output
5. open General Behavior KCM
6. uncheck 'Middle click: Paste selected text' and apply the change
7. alt+tab to Konsole and select another word from 'ls' output

OBSERVED RESULT
Konsole closes, 'coredumpctl' indicates no crash

EXPECTED RESULT
Konsole remains open

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.25.80
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5
Graphics Platform: Wayland
Comment 1 Nate Graham 2022-06-30 16:03:00 UTC
Can reproduce 100%. There's no backtrace; the app doesn't seem to be actually crashing.
Comment 2 Zamundaaa 2022-06-30 18:26:09 UTC
It does crash, with the following message:
> wl_display@1: error 0: invalid object 45
Comment 3 David Edmundson 2022-07-14 14:38:41 UTC
>It does crash
Technically that's not a crash. Which is why there's no backtrace for Nate. It's doing something kwin defines as illegal referencing an object it doesn't know about.

We're doing something very unexpected removing a global. We have all the typical races with the global which might be binding in flight but also all the existing DataDevices and DataOffers open which should still exist until a client drops them. I doubt we do the right thing, I'm even more doubtful that Qt and every client will.

I suspect it might be far easier to add a boolean into Seat to make it do nothing for future events than to delete the global at runtime and fix every client.
Comment 4 Méven Car 2022-07-23 09:21:49 UTC
(In reply to David Edmundson from comment #3)
> >It does crash
> Technically that's not a crash. Which is why there's no backtrace for Nate.
> It's doing something kwin defines as illegal referencing an object it
> doesn't know about.
> 
> We're doing something very unexpected removing a global. We have all the
> typical races with the global which might be binding in flight but also all
> the existing DataDevices and DataOffers open which should still exist until
> a client drops them. I doubt we do the right thing, I'm even more doubtful
> that Qt and every client will.
> 
> I suspect it might be far easier to add a boolean into Seat to make it do
> nothing for future events than to delete the global at runtime and fix every
> client.

I will try that.

Another workaround would be to make the settings only change on a new session and not dynamically.
Comment 5 Bug Janitor Service 2022-07-23 10:29:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2708
Comment 6 Bug Janitor Service 2022-09-29 09:35:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3012
Comment 7 Vlad Zahorodnii 2022-09-29 10:43:10 UTC
Git commit e60f26e0abd71d65044345675b64e45d7b3cd311 by Vlad Zahorodnii, on behalf of Méven Car.
Committed on 29/09/2022 at 10:32.
Pushed by vladz into branch 'master'.

Disable PrimarySelection in seat setPrimarySelection

M  +1    -1    src/main_wayland.cpp
M  +33   -1    src/wayland/autotests/server/test_datacontrol_interface.cpp
M  +15   -0    src/wayland/seat_interface.cpp
M  +2    -0    src/wayland/seat_interface.h
M  +1    -0    src/wayland/seat_interface_p.h
M  +2    -11   src/wayland_server.cpp
M  +0    -3    src/wayland_server.h

https://invent.kde.org/plasma/kwin/commit/e60f26e0abd71d65044345675b64e45d7b3cd311
Comment 8 Vlad Zahorodnii 2022-09-30 07:09:32 UTC
Git commit abf40c4a94c2c19dab4324c5879ca01ad048ffdc by Vlad Zahorodnii, on behalf of Méven Car.
Committed on 29/09/2022 at 11:09.
Pushed by vladz into branch 'Plasma/5.26'.

Disable PrimarySelection in seat setPrimarySelection
(cherry picked from commit e60f26e0abd71d65044345675b64e45d7b3cd311)

M  +1    -1    src/main_wayland.cpp
M  +33   -1    src/wayland/autotests/server/test_datacontrol_interface.cpp
M  +15   -0    src/wayland/seat_interface.cpp
M  +2    -0    src/wayland/seat_interface.h
M  +1    -0    src/wayland/seat_interface_p.h
M  +2    -11   src/wayland_server.cpp
M  +0    -2    src/wayland_server.h

https://invent.kde.org/plasma/kwin/commit/abf40c4a94c2c19dab4324c5879ca01ad048ffdc