Bug 468548 - Toggling selection mode with spacebar, on, off, then on again, crashes dolphin
Summary: Toggling selection mode with spacebar, on, off, then on again, crashes dolphin
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: Selection Mode (show other bugs)
Version: 22.04.2
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: KFM Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-15 23:15 UTC by manuelchaves
Modified: 2023-08-02 00:53 UTC (History)
3 users (show)

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


Attachments
New crash information added by DrKonqi (4.13 KB, text/plain)
2023-08-02 00:53 UTC, udonge
Details

Note You need to log in before you can comment on or make changes to this bug.
Description manuelchaves 2023-04-15 23:15:23 UTC
Dolphin version 22.12.3
I'm not use Plasma.
Toggling selection mode with spacebar, on, off, then on again, crashes dolphin.
At least it auto-closes, not sure if it's a crash, I see no error.
Comment 1 manuelchaves 2023-04-16 00:57:08 UTC
I'm not using Plasma*
I'm using another wm
Comment 2 Felix Ernst 2023-04-16 23:08:56 UTC
I am unfortunately unable to reproduce: I can press the Space bar again and again frenetically like a crazy person and nothing unusual happens. This shouldn't really be different whether one is using Plasma or not, so I have no clue what might cause the closing of Dolphin on your end.
Comment 3 manuelchaves 2023-04-17 07:42:50 UTC
If I run it on a terminal it outputs this:

QCoreApplication::postEvent: Unexpected null receiver
fish: Job 1, 'dolphin' terminated by signal SIGSEGV (Address boundary error)
Comment 4 Felix Ernst 2023-04-17 09:42:07 UTC
Would you be able to provide a backtrace? https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports

I can't promise I'll be able to figure out the cause of the crash from a backtrace but it would be a start.
Comment 5 manuelchaves 2023-04-18 09:58:21 UTC
Thread 1 "dolphin" received signal SIGSEGV, Segmentation fault.
0x00007ffff6a3722e in QObject::inherits (classname=<optimized out>, this=<optimized out>, 
    this=<optimized out>, classname=<optimized out>)
    at ../../include/QtCore/../../src/corelib/kernel/qobject.h:428
Downloading source file /usr/src/debug/qt5-base/qtbase/src/widgets/../../include/QtCore/../../src/corelib/kernel/qobject.h
428             { return const_cast<QObject *>(this)->qt_metacast(classname) != nullptr; }
Comment 6 manuelchaves 2023-04-18 10:01:22 UTC
#0  0x00007ffff6a3722e in QObject::inherits (classname=<optimized out>, this=<optimized out>, 
    this=<optimized out>, classname=<optimized out>)
    at ../../include/QtCore/../../src/corelib/kernel/qobject.h:428
#1  QStyleSheetStyle::getDefaultStyleSheet (this=0x555556636870)
    at styles/qstylesheetstyle_default.cpp:157
#2  0x00007ffff6a0ff3b in QStyleSheetStyle::styleRules (this=this@entry=0x555556636870,
Comment 7 manuelchaves 2023-04-18 10:13:36 UTC
yo@WindyCityHeat ~> gdb /usr/bin/dolphin
GNU gdb (GDB) 13.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
--Type <RET> for more, q to quit, c to continue without paging--
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/dolphin...
--Type <RET> for more, q to quit, c to continue without paging--
(No debugging symbols found in /usr/bin/dolphin)
(gdb) run
Starting program: /usr/bin/dolphin 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffefe7d6c0 (LWP 6000)]
[New Thread 0x7fffef67c6c0 (LWP 6001)]
[New Thread 0x7fffeec646c0 (LWP 6002)]
[New Thread 0x7fffece236c0 (LWP 6003)]
[New Thread 0x7fffd65ff6c0 (LWP 6004)]
[New Thread 0x7fffd5dfe6c0 (LWP 6005)]
[New Thread 0x7fffd55fd6c0 (LWP 6006)]
[New Thread 0x7fffd4dfc6c0 (LWP 6007)]
[Detaching after fork from child process 6008]
[Detaching after fork from child process 6017]
[Detaching after fork from child process 6022]
[New Thread 0x7fffbffff6c0 (LWP 6028)]
[New Thread 0x7fffbf7fe6c0 (LWP 6036)]
[New Thread 0x7fffbeffd6c0 (LWP 6037)]
[New Thread 0x7fffbe7fc6c0 (LWP 6038)]
[New Thread 0x7fffbdffb6c0 (LWP 6039)]
[New Thread 0x7fffbd7fa6c0 (LWP 6051)]
[New Thread 0x7fffbcff96c0 (LWP 6052)]
QCoreApplication::postEvent: Unexpected null receiver

Thread 1 "dolphin" received signal SIGSEGV, Segmentation fault.
0x00007ffff6a3722e in ?? () from /usr/lib/libQt5Widgets.so.5
(gdb) backtrace
#0  0x00007ffff6a3722e in ?? () from /usr/lib/libQt5Widgets.so.5
#1  0x00007ffff6a0ff3b in ?? () from /usr/lib/libQt5Widgets.so.5
#2  0x00007ffff6a10d60 in ?? () from /usr/lib/libQt5Widgets.so.5
#3  0x00007ffff6a16488 in ?? () from /usr/lib/libQt5Widgets.so.5
#4  0x00007ffff6a16a45 in ?? () from /usr/lib/libQt5Widgets.so.5
#5  0x00007ffff69a5378 in QWidgetPrivate::setStyle_helper(QStyle*, bool) ()
   from /usr/lib/libQt5Widgets.so.5
#6  0x00007ffff69a54fd in QWidgetPrivate::setStyle_helper(QStyle*, bool) ()
--Type <RET> for more, q to quit, c to continue without paging--
   from /usr/lib/libQt5Widgets.so.5
#7  0x00007ffff7f2a1dd in DolphinView::setSelectionModeEnabled(bool) ()
   from /usr/lib/libdolphinprivate.so.5
#8  0x00005555555b4ae1 in ?? ()
#9  0x00007ffff5cbeb41 in ?? () from /usr/lib/libQt5Core.so.5
#10 0x00007ffff7eb868e in DolphinViewActionHandler::selectionModeChangeTriggered(bool, SelectionMode::BottomBar::Contents) () from /usr/lib/libdolphinprivate.so.5
#11 0x00007ffff5cbeb41 in ?? () from /usr/lib/libQt5Core.so.5
--Type <RET> for more, q to quit, c to continue without paging--
#12 0x00007ffff7eb84c7 in DolphinView::selectionModeChangeRequested(bool) ()
   from /usr/lib/libdolphinprivate.so.5
#13 0x00007ffff5cbeb41 in ?? () from /usr/lib/libQt5Core.so.5
#14 0x00007ffff7eb5ff7 in KItemListController::selectionModeChangeRequested(bool) ()
   from /usr/lib/libdolphinprivate.so.5
#15 0x00007ffff7ef2fd6 in KItemListController::keyPressEvent(QKeyEvent*) ()
   from /usr/lib/libdolphinprivate.so.5
#16 0x00007ffff7ef83e2 in KItemListView::event(QEvent*) ()
--Type <RET> for more, q to quit, c to continue without paging--
   from /usr/lib/libdolphinprivate.so.5
#17 0x00007ffff6978b5c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/libQt5Widgets.so.5
#18 0x00007ffff5c8e028 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
   from /usr/lib/libQt5Core.so.5
#19 0x00007ffff69af721 in QWidget::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#20 0x00007ffff6a5db03 in QFrame::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#21 0x00007ffff6978b5c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
--Type <RET> for more, q to quit, c to continue without paging--
   from /usr/lib/libQt5Widgets.so.5
#22 0x00007ffff697de38 in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/libQt5Widgets.so.5
#23 0x00007ffff5c8e028 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
   from /usr/lib/libQt5Core.so.5
#24 0x00007ffff69cf34b in ?? () from /usr/lib/libQt5Widgets.so.5
#25 0x00007ffff6978b5c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/libQt5Widgets.so.5
--Type <RET> for more, q to quit, c to continue without paging--
#26 0x00007ffff5c8e028 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
   from /usr/lib/libQt5Core.so.5
#27 0x00007ffff6140a40 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /usr/lib/libQt5Gui.so.5
#28 0x00007ffff61298c5 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5
#29 0x00007fffeff2e8c0 in ?? () from /usr/lib/libQt5XcbQpa.so.5
#30 0x00007ffff3b0f53b in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
--Type <RET> for more, q to quit, c to continue without paging--
#31 0x00007ffff3b6c219 in ?? () from /usr/lib/libglib-2.0.so.0
#32 0x00007ffff3b0e1a2 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#33 0x00007ffff5cd8d3c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#34 0x00007ffff5c8668c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/libQt5Core.so.5
#35 0x00007ffff5c912f9 in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
#36 0x000055555559cf53 in ?? ()
--Type <RET> for more, q to quit, c to continue without paging--
#37 0x00007ffff543c790 in ?? () from /usr/lib/libc.so.6
#38 0x00007ffff543c84a in __libc_start_main () from /usr/lib/libc.so.6
#39 0x000055555559d695 in ?? ()
Comment 8 manuelchaves 2023-04-18 11:22:47 UTC
Not sure if that's useful :/
Comment 9 Bug Janitor Service 2023-04-18 22:27:27 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/530
Comment 10 Felix Ernst 2023-04-18 22:45:39 UTC
Not sure if the merge request I created actually fixes this crash, but I think it is likely that it does.

If you are able to test the change (https://community.kde.org/Infrastructure/GitLab#Testing_someone_else's_merge_request) that would be neat. Then you would be able to confirm if it fixes the crash. But it is not that easy to set up a development environment, so I understand if you don't/can't. I think it is somewhat likely that I'll be able to merge the change regardless in which case we will know if it actually fixed the issue in a couple of month when your distro provides the next Dolphin version as an update to you.
Comment 11 Felix Ernst 2023-04-20 14:43:15 UTC
Git commit 49ea43e24fede0dd001c594db9f35935facebba8 by Felix Ernst, on behalf of Felix Ernst.
Committed on 20/04/2023 at 14:42.
Pushed by felixernst into branch 'master'.

Reuse existing proxy style

Before this commit, a new QProxyStyle was created every time the
selection mode was enabled. The previously used one was
automatically deleted in the process because of the std::unique_ptr
re-assignment. This isn't really a problem in itself, but I
strongly assume that the sudden deletion of the old style shortly
before setting a new style might be the cause of the crash/bug
468548.

This commit simply re-uses the previously created proxy style which
doesn't seem to cause any behaviour change even when the
application style has been changed in the time since the proxy
style was created.

Another potential solution might be to simply use deleteLater() on
the old proxy style instead of letting std::unique_ptr delete the
old proxy style instantly while it is still in use. That seems more
involved than simply re-using the old style though.
FIXED-IN: 23.08

M  +3    -1    src/views/dolphinview.cpp

https://invent.kde.org/system/dolphin/commit/49ea43e24fede0dd001c594db9f35935facebba8
Comment 12 Felix Ernst 2023-04-20 14:45:18 UTC
Okay, merged it. This change will be available in Dolphin 23.08. If you still encounter this issue while using Dolphin 23.08 (which will be released in August 2023 and then show up as an update to you some weeks/month later depending on your distribution), please let me know.
Comment 13 Nate Graham 2023-04-20 22:03:42 UTC
Seems like a small change. Could we consider backporting it to 23.04.x? Do you think it's risky?
Comment 14 Felix Ernst 2023-04-21 09:50:01 UTC
Yes, it seems a bit risky to me because I don't really understand how QProxyStyle works exactly. It has to interact with our ability to change the theme within applications at runtime, e.g. by first forwarding Style questions to Breeze and then suddenly to Oxygen. This all worked perfectly from my testing, but since this crash AFAIK only affects few people (one report in 4 month), I would not risk it.
Comment 15 manuelchaves 2023-04-21 19:56:12 UTC
Nice, glad to see an improvement was found, thanks.
Just wanted to add, for more information, that I use this to set qt themes:
export QT_QPA_PLATFORMTHEME=qt5ct
(in .xinitrc)
Comment 16 udonge 2023-08-02 00:53:23 UTC
Created attachment 160676 [details]
New crash information added by DrKonqi

dolphin (23.04.3) using Qt 5.15.10

When pressing the spacebar 3 times consecutively, Dolphin crashes. 

I'm using Nobara KDE, but the crash doesn't happen when I'm on KDE, only when I'm on bspwm.

When running from the terminal, dolphin gives this output when crashing:
QCoreApplication::postEvent: Unexpected null receiver
KCrash: Application 'dolphin' crashing...
KCrash: Attempting to start /usr/libexec/drkonqi
QSocketNotifier: Invalid socket 6 and type 'Read', disabling...
QSocketNotifier: Invalid socket 9 and type 'Read', disabling...
QSocketNotifier: Invalid socket 19 and type 'Read', disabling...
QSystemTrayIcon::setVisible: No Icon set
[1]  + 5001 suspended (signal)  dolphin

-- Backtrace (Reduced):
#4  0x00007f7f24c77df1 in QStyleSheetStyle::getDefaultStyleSheet() const () from /lib64/libQt5Widgets.so.5
#5  0x00007f7f24c50d9b in QStyleSheetStyle::styleRules(QObject const*) const () from /lib64/libQt5Widgets.so.5
#6  0x00007f7f24c588b7 in QStyleSheetStyle::renderRule(QObject const*, int, unsigned long long) const () from /lib64/libQt5Widgets.so.5
#7  0x00007f7f24c5ac81 in QStyleSheetStyle::setGeometry(QWidget*) () from /lib64/libQt5Widgets.so.5
#8  0x00007f7f24c5b206 in QStyleSheetStyle::unpolish(QWidget*) () from /lib64/libQt5Widgets.so.5