<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>461901</bug_id>
          
          <creation_ts>2022-11-16 10:46:46 +0000</creation_ts>
          <short_desc>kwin_wayland crashes in std::__shared_ptr&lt;KWin::OutputMode() when I tap the touchscreen after disconnecting an external monitor</short_desc>
          <delta_ts>2022-12-04 22:19:31 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Plasma</classification>
          <product>kwin</product>
          <component>multi-screen</component>
          <version>master</version>
          <rep_platform>Neon</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>wayland-only</keywords>
          <priority>NOR</priority>
          <bug_severity>crash</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Patrick Silva">bugseforuns</reporter>
          <assigned_to name="KWin default assignee">kwin-bugs-null</assigned_to>
          <cc>andretiagob</cc>
    
    <cc>me</cc>
    
    <cc>nate</cc>
    
    <cc>nicolas.fella</cc>
    
    <cc>notmart</cc>
    
    <cc>xaver.hugl</cc>
          
          <cf_commitlink>https://invent.kde.org/plasma/kwin/commit/8fe8d0a1ac969fbaae196bb41dd7bb36655d93e8</cf_commitlink>
          <cf_versionfixedin>5.26.4</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2174064</commentid>
    <comment_count>0</comment_count>
    <who name="Patrick Silva">bugseforuns</who>
    <bug_when>2022-11-16 10:46:46 +0000</bug_when>
    <thetext>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 &apos;Switch to external screen&apos;
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=&lt;optimized out&gt;, pfd=&lt;optimized out&gt;, ev=0x7f943effc8f0, n_ev=&lt;optimized out&gt;, timeout=&lt;optimized out&gt;) 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=&lt;optimized out&gt;) 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=&lt;optimized out&gt;, n_fds=3, fds=0x7f944c0053c0, timeout=&lt;optimized out&gt;, 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=&lt;optimized out&gt;) 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&lt;QEventLoop::ProcessEventsFlag&gt;) (this=0x7f944c000b70, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#5  0x00007f9458cba9bb in QEventLoop::exec(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) (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 &lt;(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder&gt;) at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#7  0x00007f945ac1af1b in QDBusConnectionManager::run() (this=0x7f945ac93d80 &lt;(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder&gt;) at ./src/dbus/qdbusconnection.cpp:179
#8  0x00007f9458ace703 in QThreadPrivate::start(void*) (arg=0x7f945ac93d80 &lt;(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder&gt;) at thread/qthread_unix.cpp:330
#9  0x00007f9457a94b43 in start_thread (arg=&lt;optimized out&gt;) 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=&lt;optimized out&gt;) at ../include/c11/threads_posix.h:87
#8  0x00007f9457a94b43 in start_thread (arg=&lt;optimized out&gt;) 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=&lt;optimized out&gt;, n_fds=2, fds=0x7f94380029e0, timeout=&lt;optimized out&gt;, 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=&lt;optimized out&gt;) 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&lt;QEventLoop::ProcessEventsFlag&gt;) (this=0x7f9438000b70, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#5  0x00007f9458cba9bb in QEventLoop::exec(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) (this=this@entry=0x7f94457fdb40, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#6  0x00007f9458acd4e2 in QThread::exec() (this=&lt;optimized out&gt;) 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=&lt;optimized out&gt;) 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=&lt;optimized out&gt;) at ../include/c11/threads_posix.h:87
#8  0x00007f9457a94b43 in start_thread (arg=&lt;optimized out&gt;) 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=&lt;optimized out&gt;, n_fds=1, fds=0x7f94240029e0, timeout=&lt;optimized out&gt;, 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=&lt;optimized out&gt;) 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&lt;QEventLoop::ProcessEventsFlag&gt;) (this=0x7f9424000b70, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#5  0x00007f9458cba9bb in QEventLoop::exec(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) (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=&lt;optimized out&gt;) 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=&lt;optimized out&gt;) at ../include/c11/threads_posix.h:87
#8  0x00007f9457a94b43 in start_thread (arg=&lt;optimized out&gt;) 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&lt;KWin::OutputMode, (__gnu_cxx::_Lock_policy)2&gt;::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=&lt;optimized out&gt;, 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&lt;QEventLoop::ProcessEventsFlag&gt;) (this=0x55e4cc08f0d0, flags=...) at kernel/qeventdispatcher_unix.cpp:468
#8  0x000055e4cac9e331 in QUnixEventDispatcherQPA::processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) ()
#9  0x00007f9458cba9bb in QEventLoop::exec(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) (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=&lt;optimized out&gt;, argv=&lt;optimized out&gt;) at ./src/main_wayland.cpp:620</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2174180</commentid>
    <comment_count>1</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2022-11-16 18:39:20 +0000</bug_when>
    <thetext>I can reproduce the issue and the backtrace with those exact steps.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2175191</commentid>
    <comment_count>2</comment_count>
    <who name="Bug Janitor Service">bug-janitor</who>
    <bug_when>2022-11-19 14:12:55 +0000</bug_when>
    <thetext>A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3217</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2176020</commentid>
    <comment_count>3</comment_count>
    <who name="Bug Janitor Service">bug-janitor</who>
    <bug_when>2022-11-21 13:50:37 +0000</bug_when>
    <thetext>A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3220</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2176021</commentid>
    <comment_count>4</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2022-11-21 13:51:38 +0000</bug_when>
    <thetext>Git commit cdeacdbdadedb1ac6ea64a51e016737e485b4067 by Xaver Hugl.
Committed on 21/11/2022 at 13:25.
Pushed by zamundaaa into branch &apos;master&apos;.

backends/libinput: update screens on Workspace::outputsChanged

Using OutputBackend::outputsQueried can cause problems because it&apos;s emitted
before output settings like enablement get adjusted to the new output configuration.
It also doesn&apos;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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2176054</commentid>
    <comment_count>5</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2022-11-21 16:49:22 +0000</bug_when>
    <thetext>Git commit 8fe8d0a1ac969fbaae196bb41dd7bb36655d93e8 by Xaver Hugl.
Committed on 21/11/2022 at 13:42.
Pushed by zamundaaa into branch &apos;Plasma/5.26&apos;.

backends/libinput: update screens on Workspace::outputsChanged

Using OutputBackend::outputsQueried can cause problems because it&apos;s emitted
before output settings like enablement get adjusted to the new output configuration.
It also doesn&apos;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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2181284</commentid>
    <comment_count>6</comment_count>
    <who name="Nicolas Fella">nicolas.fella</who>
    <bug_when>2022-12-04 22:19:31 +0000</bug_when>
    <thetext>*** Bug 462407 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>