Bug 461901 - kwin_wayland crashes in std::__shared_ptr<KWin::OutputMode() when I tap the touchscreen after disconnecting an external monitor
Summary: kwin_wayland crashes in std::__shared_ptr<KWin::OutputMode() when I tap the t...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: multi-screen (show other bugs)
Version: master
Platform: Neon Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: wayland
: 462407 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-11-16 10:46 UTC by Patrick Silva
Modified: 2022-12-04 22:19 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.26.4


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2022-11-16 10:46:46 UTC
STEPS TO REPRODUCE
1. use Wayland on a device with a touchscreen - I use a laptop
2. connect an external monitor to hdmi port
3. press meta+p and choose 'Switch to external screen'
4. disconnect the external monitor from the hdmi port
5. try to open kickoff using the touchscreen

OBSERVED RESULT
kwin_wayland crashes

EXPECTED RESULT
no crash

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.26.80
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.7
Graphics Platform: Wayland


Thread 8 (Thread 0x7f943effd640 (LWP 1783)):
#0  0x00007f9457b25fde in epoll_wait (epfd=90, events=events@entry=0x7f943effc740, maxevents=32, timeout=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
#1  0x00007f9444e5b918 in impl_pollfd_wait (object=<optimized out>, pfd=<optimized out>, ev=0x7f943effc8f0, n_ev=<optimized out>, timeout=<optimized out>) at ../spa/plugins/support/system.c:157
#2  0x00007f9444e4ed7c in loop_iterate (object=0x55e4ccf16668, timeout=-1) at ../spa/plugins/support/loop.c:345
#3  0x00007f9458966226 in do_loop (user_data=0x55e4ccf92f60) at ../src/pipewire/data-loop.c:81
#4  0x00007f9457a94b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#5  0x00007f9457b26a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 7 (Thread 0x7f94533ff640 (LWP 1123)):
#0  0x00007f9457b18d7f in __GI___poll (fds=0x7f944c0053c0, nfds=3, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f94564a6696 in g_main_context_poll (priority=<optimized out>, n_fds=3, fds=0x7f944c0053c0, timeout=<optimized out>, context=0x7f944c001cf0) at ../../../glib/gmain.c:4516
#2  g_main_context_iterate.constprop.0 (context=context@entry=0x7f944c001cf0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4206
#3  0x00007f945644f3c3 in g_main_context_iteration (context=0x7f944c001cf0, may_block=1) at ../../../glib/gmain.c:4276
#4  0x00007f9458d15af8 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7f944c000b70, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#5  0x00007f9458cba9bb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7f94533feb10, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#6  0x00007f9458acd4e2 in QThread::exec() (this=this@entry=0x7f945ac93d80 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#7  0x00007f945ac1af1b in QDBusConnectionManager::run() (this=0x7f945ac93d80 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at ./src/dbus/qdbusconnection.cpp:179
#8  0x00007f9458ace703 in QThreadPrivate::start(void*) (arg=0x7f945ac93d80 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at thread/qthread_unix.cpp:330
#9  0x00007f9457a94b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#10 0x00007f9457b26a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 6 (Thread 0x7f943f7fe640 (LWP 1143)):
#0  __futex_abstimed_wait_common64 (private=0, cancel=true, abstime=0x0, op=393, expected=0, futex_word=0x7f9450588550) at ./nptl/futex-internal.c:57
#1  __futex_abstimed_wait_common (cancel=true, private=0, abstime=0x0, clockid=0, expected=0, futex_word=0x7f9450588550) at ./nptl/futex-internal.c:87
#2  __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x7f9450588550, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0) at ./nptl/futex-internal.c:139
#3  0x00007f9457a93ac1 in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f9450588500, cond=0x7f9450588528) at ./nptl/pthread_cond_wait.c:503
#4  ___pthread_cond_wait (cond=cond@entry=0x7f9450588528, mutex=mutex@entry=0x7f9450588500) at ./nptl/pthread_cond_wait.c:627
#5  0x00007f9450abf85b in cnd_wait (mtx=0x7f9450588500, cond=0x7f9450588528) at ../include/c11/threads_posix.h:155
#6  util_queue_thread_func (input=input@entry=0x55e4cc2502a0) at ../src/util/u_queue.c:294
#7  0x00007f9450abf48b in impl_thrd_routine (p=<optimized out>) at ../include/c11/threads_posix.h:87
#8  0x00007f9457a94b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#9  0x00007f9457b26a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 5 (Thread 0x7f94457fe640 (LWP 1137)):
#0  0x00007f9457b18d7f in __GI___poll (fds=0x7f94380029e0, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f94564a6696 in g_main_context_poll (priority=<optimized out>, n_fds=2, fds=0x7f94380029e0, timeout=<optimized out>, context=0x7f9438000c30) at ../../../glib/gmain.c:4516
#2  g_main_context_iterate.constprop.0 (context=context@entry=0x7f9438000c30, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4206
#3  0x00007f945644f3c3 in g_main_context_iteration (context=0x7f9438000c30, may_block=1) at ../../../glib/gmain.c:4276
#4  0x00007f9458d15af8 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7f9438000b70, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#5  0x00007f9458cba9bb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7f94457fdb40, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#6  0x00007f9458acd4e2 in QThread::exec() (this=<optimized out>) at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#7  0x00007f9458ace703 in QThreadPrivate::start(void*) (arg=0x55e4cc14bff8) at thread/qthread_unix.cpp:330
#8  0x00007f9457a94b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#9  0x00007f9457b26a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 4 (Thread 0x7f9445fff640 (LWP 1136)):
#0  __futex_abstimed_wait_common64 (private=0, cancel=true, abstime=0x0, op=393, expected=0, futex_word=0x55e4cc14dd48) at ./nptl/futex-internal.c:57
#1  __futex_abstimed_wait_common (cancel=true, private=0, abstime=0x0, clockid=0, expected=0, futex_word=0x55e4cc14dd48) at ./nptl/futex-internal.c:87
#2  __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x55e4cc14dd48, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0) at ./nptl/futex-internal.c:139
#3  0x00007f9457a93ac1 in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x55e4cc14dcf8, cond=0x55e4cc14dd20) at ./nptl/pthread_cond_wait.c:503
#4  ___pthread_cond_wait (cond=cond@entry=0x55e4cc14dd20, mutex=mutex@entry=0x55e4cc14dcf8) at ./nptl/pthread_cond_wait.c:627
#5  0x00007f9450abf85b in cnd_wait (mtx=0x55e4cc14dcf8, cond=0x55e4cc14dd20) at ../include/c11/threads_posix.h:155
#6  util_queue_thread_func (input=input@entry=0x55e4cc14c0b0) at ../src/util/u_queue.c:294
#7  0x00007f9450abf48b in impl_thrd_routine (p=<optimized out>) at ../include/c11/threads_posix.h:87
#8  0x00007f9457a94b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#9  0x00007f9457b26a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 3 (Thread 0x7f943e7fc640 (LWP 1146)):
#0  0x00007f9457b18d7f in __GI___poll (fds=0x7f94240029e0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f94564a6696 in g_main_context_poll (priority=<optimized out>, n_fds=1, fds=0x7f94240029e0, timeout=<optimized out>, context=0x7f9424000c30) at ../../../glib/gmain.c:4516
#2  g_main_context_iterate.constprop.0 (context=context@entry=0x7f9424000c30, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4206
#3  0x00007f945644f3c3 in g_main_context_iteration (context=0x7f9424000c30, may_block=1) at ../../../glib/gmain.c:4276
#4  0x00007f9458d15af8 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7f9424000b70, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#5  0x00007f9458cba9bb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7f943e7fbb20, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#6  0x00007f9458acd4e2 in QThread::exec() (this=this@entry=0x55e4cc4131c0) at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#7  0x00007f9459d32959 in QQmlThreadPrivate::run() (this=0x55e4cc4131c0) at qml/ftw/qqmlthread.cpp:155
#8  0x00007f9458ace703 in QThreadPrivate::start(void*) (arg=0x55e4cc4131c0) at thread/qthread_unix.cpp:330
#9  0x00007f9457a94b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#10 0x00007f9457b26a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 2 (Thread 0x7f943ffff640 (LWP 1142)):
#0  __futex_abstimed_wait_common64 (private=0, cancel=true, abstime=0x0, op=393, expected=0, futex_word=0x7f945062d550) at ./nptl/futex-internal.c:57
#1  __futex_abstimed_wait_common (cancel=true, private=0, abstime=0x0, clockid=0, expected=0, futex_word=0x7f945062d550) at ./nptl/futex-internal.c:87
#2  __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x7f945062d550, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0) at ./nptl/futex-internal.c:139
#3  0x00007f9457a93ac1 in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f945062d500, cond=0x7f945062d528) at ./nptl/pthread_cond_wait.c:503
#4  ___pthread_cond_wait (cond=cond@entry=0x7f945062d528, mutex=mutex@entry=0x7f945062d500) at ./nptl/pthread_cond_wait.c:627
#5  0x00007f9450abf85b in cnd_wait (mtx=0x7f945062d500, cond=0x7f945062d528) at ../include/c11/threads_posix.h:155
#6  util_queue_thread_func (input=input@entry=0x55e4cc25f980) at ../src/util/u_queue.c:294
#7  0x00007f9450abf48b in impl_thrd_routine (p=<optimized out>) at ../include/c11/threads_posix.h:87
#8  0x00007f9457a94b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#9  0x00007f9457b26a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 1 (Thread 0x7f9453c779c0 (LWP 1107)):
#0  std::__shared_ptr<KWin::OutputMode, (__gnu_cxx::_Lock_policy)2>::operator bool() const (this=0x38) at /usr/include/c++/11/bits/shared_ptr_base.h:1299
#1  KWin::Output::modeSize() const (this=0x0) at ./src/core/output.cpp:189
#2  0x00007f945a95d373 in KWin::LibInput::Connection::processEvents() (this=0x55e4cc1f6c70) at ./src/backends/libinput/connection.cpp:378
#3  0x00007f9458ce9afe in QObject::event(QEvent*) (this=0x55e4cc14bfe0, e=0x7f9438007350) at kernel/qobject.cpp:1347
#4  0x00007f945836c763 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x55e4cc14bfe0, e=0x7f9438007350) at kernel/qapplication.cpp:3637
#5  0x00007f9458cbc09a in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55e4cc14bfe0, event=0x7f9438007350) at kernel/qcoreapplication.cpp:1064
#6  0x00007f9458cbf187 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=data@entry=0x55e4cc076170) at kernel/qcoreapplication.cpp:1821
#7  0x00007f9458d12f5e in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55e4cc08f0d0, flags=...) at kernel/qeventdispatcher_unix.cpp:468
#8  0x000055e4cac9e331 in QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
#9  0x00007f9458cba9bb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7ffddc3e77f0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#10 0x00007f9458cc2f54 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#11 0x00007f94591364e0 in QGuiApplication::exec() () at kernel/qguiapplication.cpp:1870
#12 0x00007f945836c6d9 in QApplication::exec() () at kernel/qapplication.cpp:2829
#13 0x000055e4cabbff5f in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at ./src/main_wayland.cpp:620
Comment 1 Nate Graham 2022-11-16 18:39:20 UTC
I can reproduce the issue and the backtrace with those exact steps.
Comment 2 Bug Janitor Service 2022-11-19 14:12:55 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3217
Comment 3 Bug Janitor Service 2022-11-21 13:50:37 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3220
Comment 4 Zamundaaa 2022-11-21 13:51:38 UTC
Git commit cdeacdbdadedb1ac6ea64a51e016737e485b4067 by Xaver Hugl.
Committed on 21/11/2022 at 13:25.
Pushed by zamundaaa into branch 'master'.

backends/libinput: update screens on Workspace::outputsChanged

Using OutputBackend::outputsQueried can cause problems because it's emitted
before output settings like enablement get adjusted to the new output configuration.
It also doesn't react to output changes initiated by KScreen and is in the
way of plans to use multiple output backends at the same time.

M  +0    -1    src/backends/libinput/connection.cpp
M  +5    -0    src/backends/libinput/libinputbackend.cpp
M  +1    -0    src/backends/libinput/libinputbackend.h
M  +4    -0    src/core/inputbackend.h
M  +8    -0    src/input.cpp
M  +1    -0    src/input.h

https://invent.kde.org/plasma/kwin/commit/cdeacdbdadedb1ac6ea64a51e016737e485b4067
Comment 5 Zamundaaa 2022-11-21 16:49:22 UTC
Git commit 8fe8d0a1ac969fbaae196bb41dd7bb36655d93e8 by Xaver Hugl.
Committed on 21/11/2022 at 13:42.
Pushed by zamundaaa into branch 'Plasma/5.26'.

backends/libinput: update screens on Workspace::outputsChanged

Using OutputBackend::outputsQueried can cause problems because it's emitted
before output settings like enablement get adjusted to the new output configuration.
It also doesn't react to output changes initiated by KScreen and is in the
way of plans to use multiple output backends at the same time.
(cherry picked from commit cdeacdbdadedb1ac6ea64a51e016737e485b4067)

M  +0    -1    src/backends/libinput/connection.cpp
M  +5    -0    src/backends/libinput/libinputbackend.cpp
M  +1    -0    src/backends/libinput/libinputbackend.h
M  +4    -0    src/core/inputbackend.h
M  +8    -0    src/input.cpp
M  +1    -0    src/input.h

https://invent.kde.org/plasma/kwin/commit/8fe8d0a1ac969fbaae196bb41dd7bb36655d93e8
Comment 6 Nicolas Fella 2022-12-04 22:19:31 UTC
*** Bug 462407 has been marked as a duplicate of this bug. ***