Bug 454341

Summary: Plasma crashes in WindowSystem::requestToken() when clicking on an SNI or a notification
Product: [Frameworks and Libraries] kwayland-integration Reporter: Nate Graham <nate>
Component: generalAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: aleixpol, nicolas.fella
Priority: NOR Keywords: regression
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Nate Graham 2022-05-24 15:48:27 UTC
Rebuilt the world today and now plasmashell is 100% reproducibly crashing when I click on Discover's SNI or any notifications that want to activate a window:


#0  __GI___pthread_sigmask (how=1, newmask=<optimized out>, oldmask=0x0) at pthread_sigmask.c:43
#1  0x00007f70e06f9c6d in __GI___sigprocmask
    (how=<optimized out>, set=<optimized out>, oset=<optimized out>)
    at ../sysdeps/unix/sysv/linux/sigprocmask.c:25
#2  0x00007f70e3389e28 in KCrash::setCrashHandler(void (*)(int)) (handler=handler@entry=0x0)
    at /home/nate/kde/src/kcrash/src/kcrash.cpp:415
#3  0x00007f70e338a9ea in KCrash::defaultCrashHandler(int) (sig=11)
    at /home/nate/kde/src/kcrash/src/kcrash.cpp:632
#4  0x00007f70e06f9a70 in <signal handler called> () at /lib64/libc.so.6
#5  QWindow::create() (this=this@entry=0x0) at kernel/qwindow.cpp:650
#6  0x00007f70ccf8d865 in WindowSystem::requestToken(QWindow*, unsigned int, QString const&)
    (this=<optimized out>, window=0x0, serial=0, app_id=...)
    at /home/nate/kde/src/kwayland-integration/src/windowsystem/windowsystem.cpp:64
#7  0x00007f70bfb83106 in StatusNotifierItemJob::start() (this=0x28f8b10)
    at /home/nate/kde/src/plasma-workspace/applets/systemtray/statusnotifieritemjob.cpp:42
#8  0x00007f70e0ec0182 in QObject::event(QEvent*) (this=0x28f8b10, e=0x7f70c8005590)
    at kernel/qobject.cpp:1314
#9  0x00007f70e1d27c22 in QApplicationPrivate::notify_helper(QObject*, QEvent*)
    (this=<optimized out>, receiver=0x28f8b10, e=0x7f70c8005590) at kernel/qapplication.cpp:3637
#10 0x00007f70e0e96118 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
    (receiver=0x28f8b10, event=0x7f70c8005590) at kernel/qcoreapplication.cpp:1064
#11 0x00007f70e0e99474 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*)
    (receiver=0x0, event_type=0, data=0x9f1ec0) at kernel/qcoreapplication.cpp:1821
#12 0x00007f70e0ee7197 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0xa562c0)
    at kernel/qeventdispatcher_glib.cpp:277
#13 0x00007f70df1acf4f in g_main_dispatch (context=0xa5bd60) at ../glib/gmain.c:3417
#14 g_main_context_dispatch (context=0xa5bd60) at ../glib/gmain.c:4135
#15 0x00007f70df202168 in g_main_context_iterate.constprop.0
    (context=context@entry=0xa5bd60, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4211
#16 0x00007f70df1aa8e0 in g_main_context_iteration (context=0xa5bd60, may_block=1)
    at ../glib/gmain.c:4276
#17 0x00007f70e0ee6c8a in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0xa5b5b0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#18 0x00007f70e0e94b7a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
    (this=this@entry=0x7ffd6838fe50, flags=..., flags@entry=...)
    at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#19 0x00007f70e0e9cc22 in QCoreApplication::exec() ()
    at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#20 0x00007f70e12dae50 in QGuiApplication::exec() () at kernel/qguiapplication.cpp:1860
#21 0x00007f70e1d27b99 in QApplication::exec() () at kernel/qapplication.cpp:2829
#22 0x0000000000422a5a in main(int, char**) (argc=<optimized out>, argv=<optimized out>)
    at /home/nate/kde/src/plasma-workspace/shell/main.cpp:240
Comment 1 Bug Janitor Service 2022-05-24 16:03:05 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwayland-integration/-/merge_requests/23
Comment 2 Nicolas Fella 2022-05-24 18:37:39 UTC
Git commit 3d9bd69c9ff1f4b57eb358439831cd2238036eac by Nicolas Fella.
Committed on 24/05/2022 at 16:19.
Pushed by nicolasfella into branch 'master'.

Don't crash on a null QWindow

The earlier code checked for that, that check got removed inadvertently

Also restructure code to always emit the result signal in case of errors

M  +12   -9    src/windowsystem/windowsystem.cpp

https://invent.kde.org/plasma/kwayland-integration/commit/3d9bd69c9ff1f4b57eb358439831cd2238036eac