Bug 325517 - Dolphin crashes when comparing files without any files selected
Summary: Dolphin crashes when comparing files without any files selected
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 2.2
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords: drkonqi, reproducible
Depends on:
Blocks:
 
Reported: 2013-10-01 18:58 UTC by nn.dm55
Modified: 2013-10-13 08:57 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.11.3


Attachments
Patch (2.30 KB, patch)
2013-10-02 15:54 UTC, Frank Reininghaus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nn.dm55 2013-10-01 18:58:20 UTC
Application: dolphin (2.2)
KDE Platform Version: 4.10.5 "release 1"
Qt Version: 4.8.4
Operating System: Linux 3.7.10-1.16-default i686
Distribution: "openSUSE 12.3 (i586)"

-- Information about the crash:
- What I was doing when the application crashed:
I was trying to use QDBus to launch a dot desktop file using Dolphin and then close Dolphin. While trying to figure out which method to use, I tried out some of the Dolphin methods listed by QDBus. Then, Dolphin crashed because I forgot to select anything first. The command I ran is as follows:
qdbus org.kde.dolphin-19093 /dolphin/Dolphin_1/actions/compare_files trigger

The crash can be reproduced every time.

-- Backtrace:
Application: Dolphin (dolphin), signal: Segmentation fault
Using host libthread_db library "/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0xb0a70740 (LWP 19093))]

Thread 2 (Thread 0xaf58ab40 (LWP 19097)):
#0  0xb7672a70 in pthread_mutex_unlock () from /lib/libc.so.6
#1  0xb4ae0f20 in g_mutex_unlock (mutex=mutex@entry=0xaec004e0) at gthread-posix.c:229
#2  0xb4a9f68a in g_main_context_check (context=context@entry=0xaec004e0, max_priority=2147483647, fds=fds@entry=0xaec02278, n_fds=n_fds@entry=1) at gmain.c:3167
#3  0xb4a9fb62 in g_main_context_iterate (context=context@entry=0xaec004e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3287
#4  0xb4a9fd31 in g_main_context_iteration (context=0xaec004e0, may_block=1) at gmain.c:3351
#5  0xb589f8af in QEventDispatcherGlib::processEvents (this=0xaec00468, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#6  0xb586c39c in QEventLoop::processEvents (this=this@entry=0xaf58a228, flags=...) at kernel/qeventloop.cpp:149
#7  0xb586c691 in QEventLoop::exec (this=this@entry=0xaf58a228, flags=...) at kernel/qeventloop.cpp:204
#8  0xb5757b6c in QThread::exec (this=this@entry=0x8757f18) at thread/qthread.cpp:542
#9  0xb584a99d in QInotifyFileSystemWatcherEngine::run (this=0x8757f18) at io/qfilesystemwatcher_inotify.cpp:256
#10 0xb575af78 in QThreadPrivate::start (arg=0x8757f18) at thread/qthread_unix.cpp:338
#11 0xb5044b5e in start_thread () from /lib/libpthread.so.0
#12 0xb766516e in clone () from /lib/libc.so.6

Thread 1 (Thread 0xb0a70740 (LWP 19093)):
[KCrash Handler]
#6  0xb77395b4 in DolphinViewContainer::view (this=0x0) at /usr/src/debug/kde-baseapps-4.10.5/dolphin/src/dolphinviewcontainer.cpp:246
#7  0xb7734a00 in DolphinMainWindow::compareFiles (this=this@entry=0x86fff48) at /usr/src/debug/kde-baseapps-4.10.5/dolphin/src/dolphinmainwindow.cpp:1004
#8  0xb773765b in qt_static_metacall (_a=0xbfb35008, _id=43, _o=0x86fff48, _c=<optimized out>) at /usr/src/debug/kde-baseapps-4.10.5/build/dolphin/src/dolphinmainwindow.moc:227
#9  DolphinMainWindow::qt_static_metacall (_o=_o@entry=0x86fff48, _c=_c@entry=QMetaObject::InvokeMetaMethod, _id=_id@entry=43, _a=0xbfb35008) at /usr/src/debug/kde-baseapps-4.10.5/build/dolphin/src/dolphinmainwindow.moc:177
#10 0xb5885c22 in QMetaObject::activate (sender=sender@entry=0x8706b40, m=m@entry=0xb6776378 <QAction::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0xbfb35008) at kernel/qobject.cpp:3548
#11 0xb5dfab4d in QAction::triggered (this=this@entry=0x8706b40, _t1=false) at .moc/release-shared/moc_qaction.cpp:277
#12 0xb5dfadec in QAction::activate (this=this@entry=0x8706b40, event=event@entry=QAction::Trigger) at kernel/qaction.cpp:1257
#13 0xb5dfb19c in trigger (this=0x8706b40) at kernel/qaction.h:218
#14 qt_static_metacall (_a=0xbfb3521c, _id=8, _o=0x8706b40, _c=<optimized out>) at .moc/release-shared/moc_qaction.cpp:151
#15 QAction::qt_static_metacall (_o=0x8706b40, _c=QMetaObject::InvokeMetaMethod, _id=8, _a=0xbfb3521c) at .moc/release-shared/moc_qaction.cpp:137
#16 0xb5dfc31c in QAction::qt_metacall (this=this@entry=0x8706b40, _c=_c@entry=QMetaObject::InvokeMetaMethod, _id=8, _id@entry=12, _a=_a@entry=0xbfb3521c) at .moc/release-shared/moc_qaction.cpp:196
#17 0xb5e61d32 in QWidgetAction::qt_metacall (this=this@entry=0x8706b40, _c=_c@entry=QMetaObject::InvokeMetaMethod, _id=_id@entry=12, _a=_a@entry=0xbfb3521c) at .moc/release-shared/moc_qwidgetaction.cpp:83
#18 0xb6892762 in KAction::qt_metacall (this=0x8706b40, _c=QMetaObject::InvokeMetaMethod, _id=12, _a=0xbfb3521c) at /usr/src/debug/kdelibs-4.10.5/build/kdeui/kaction.moc:115
#19 0xb568d4d6 in QDBusConnectionPrivate::deliverCall (this=0x86422d8, object=0x8706b40, msg=..., metaTypes=..., slotIdx=0) at qdbusintegrator.cpp:951
#20 0xb568e6d4 in QDBusConnectionPrivate::activateCall (this=0x86422d8, object=0x8706b40, flags=5456, msg=...) at qdbusintegrator.cpp:863
#21 0xb568edb2 in QDBusConnectionPrivate::activateObject (this=0x86422d8, node=..., msg=..., pathStartPos=0) at qdbusintegrator.cpp:1427
#22 0xb568f1b8 in QDBusActivateObjectEvent::placeMetaCall (this=0x8cc5ff8) at qdbusintegrator.cpp:1541
#23 0xb5883bab in QObject::event (this=0x867af10, e=0x8cc5ff8) at kernel/qobject.cpp:1203
#24 0xb5e01bac in QApplicationPrivate::notify_helper (this=0x85b6438, receiver=0x867af10, e=0x8cc5ff8) at kernel/qapplication.cpp:4562
#25 0xb5e065cc in QApplication::notify (this=0x8cc5ff8, receiver=0x867af10, e=0x8cc5ff8) at kernel/qapplication.cpp:3944
#26 0xb6989ae1 in KApplication::notify (this=0xbfb35b80, receiver=0x867af10, event=0x8cc5ff8) at /usr/src/debug/kdelibs-4.10.5/kdeui/kernel/kapplication.cpp:311
#27 0xb586d8ce in QCoreApplication::notifyInternal (this=0xbfb35b80, receiver=0x867af10, event=0x8cc5ff8) at kernel/qcoreapplication.cpp:946
#28 0xb5871621 in sendEvent (event=<optimized out>, receiver=<optimized out>) at kernel/qcoreapplication.h:231
#29 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x8591e50) at kernel/qcoreapplication.cpp:1570
#30 0xb587189c in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1463
#31 0xb589f714 in sendPostedEvents () at kernel/qcoreapplication.h:236
#32 postEventSourceDispatch (s=s@entry=0x85bbb10) at kernel/qeventdispatcher_glib.cpp:279
#33 0xb4a9f8b3 in g_main_dispatch (context=0x85b4e68, context@entry=0x85b74a8) at gmain.c:2715
#34 g_main_context_dispatch (context=context@entry=0x85b4e68) at gmain.c:3219
#35 0xb4a9fc50 in g_main_context_iterate (context=context@entry=0x85b4e68, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3290
#36 0xb4a9fd31 in g_main_context_iteration (context=0x85b4e68, may_block=1) at gmain.c:3351
#37 0xb589f891 in QEventDispatcherGlib::processEvents (this=this@entry=0x8595690, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#38 0xb5eb34aa in QGuiEventDispatcherGlib::processEvents (this=0x8595690, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#39 0xb586c39c in QEventLoop::processEvents (this=this@entry=0xbfb35ab8, flags=...) at kernel/qeventloop.cpp:149
#40 0xb586c691 in QEventLoop::exec (this=this@entry=0xbfb35ab8, flags=...) at kernel/qeventloop.cpp:204
#41 0xb587194a in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1218
#42 0xb5dffa24 in QApplication::exec () at kernel/qapplication.cpp:3823
#43 0xb7741707 in kdemain (argc=1, argv=0xbfb35c64) at /usr/src/debug/kde-baseapps-4.10.5/dolphin/src/main.cpp:90
#44 0x080485bb in main (argc=1, argv=0xbfb35c64) at /usr/src/debug/kde-baseapps-4.10.5/build/dolphin/src/dolphin_dummy.cpp:3

Reported using DrKonqi
Comment 1 Frank Reininghaus 2013-10-01 22:31:40 UTC
Thanks for the bug report!

I didn't know at all that it's possible to trigger actions from outside the application using DBus. Inside Dolphin, the action is always disabled if no files are selected, but it seems that we have to add some extra checks after the action has been triggered, or find out if there is a way to disable the trigger-action-via-DBus "feature".

Aaaaargh - this is one of the moments when I really envy developers who work on systems like Windows and MacOS, which give users less freedom to mess things up in ways that the developers never intended :-(
Comment 2 Frank Reininghaus 2013-10-02 15:54:27 UTC
Created attachment 82610 [details]
Patch

Maybe my condemnation of the "trigger action via D-Bus" feature was a bit exaggerated - it turns out that rewriting the function DolphinMainWindow::compareFiles() in a crash-safe way makes the code much simpler :-)
Comment 3 Emmanuel Pescosta 2013-10-04 11:53:23 UTC
> Created attachment 82610 [details]

Works fine. Great code :) 

A "ship it" from my side!
Comment 4 Frank Reininghaus 2013-10-13 08:57:37 UTC
Git commit 42c26b155427b164c65b97faf8029aefdcddfd8a by Frank Reininghaus.
Committed on 13/10/2013 at 08:55.
Pushed by freininghaus into branch 'KDE/4.11'.

Fix crash when triggereing the "Compare files" action via D-Bus

If the number of selected items is not two, Dolphin disables this
action. However, it is still possible to trigger it via D-Bus, and this
could cause a crash in DolphinMainWindow::compareFiles() because this
function did not test at all if there are really two items selected.

This patch adds such a check and simplifies the code in that function.
FIXED-IN: 4.11.3

M  +12   -39   dolphin/src/dolphinmainwindow.cpp

http://commits.kde.org/kde-baseapps/42c26b155427b164c65b97faf8029aefdcddfd8a