Bug 339502

Summary: slotTerminalDirectoryChanged can fire before m_activeViewContainer gets assigned
Product: [Applications] dolphin Reporter: Thomas Lübking <thomas.luebking>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: arjunak234, belamenso, coder53, emmanuelpescosta099, erasmocaponio, jiri.furst, kirona75, leszek.lesner, Lildirt, michael.weyand, sarah.cipullo, wolfgangwayland7
Priority: NOR    
Version: 4.14.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 4.14.3
Sentry Crash Report:
Attachments: New crash information added by DrKonqi

Description Thomas Lübking 2014-09-29 11:39:36 UTC
I didn't encounter this myself, but got this backtrace. According to the reporter, it's 100% reproducible for him on opening an external device by

   KRun::runUrl(Solid::StorageAccess::filePath(), "inode/directory", this);

I recall claims about crashing dolphin+terminal, but not whether it's been a bug, a mail or some forum.

Thread 1 (Thread 0xb10b6740 (LWP 1656)):
[KCrash Handler]
#7  0xb767ac88 in DolphinViewContainer::setAutoGrabFocus (this=0x0, grab=grab@entry=false) at ../../../dolphin/src/dolphinviewcontainer.cpp:221
#8  0xb7679187 in DolphinMainWindow::slotTerminalDirectoryChanged (this=0x84cb998, url=...) at ../../../dolphin/src/dolphinmainwindow.cpp:315
#9  0xb7679f5b in DolphinMainWindow::qt_static_metacall (_o=0x0, _id=0, _a=0xbf92d928, _c=<optimized out>) at ./dolphinmainwindow.moc:197
#10 0xb5a450f7 in QMetaObject::activate (sender=sender@entry=0x8539340, m=m@entry=0xb76dbdc4 <TerminalPanel::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0xbf92d928) at kernel/qobject.cpp:3539
#11 0xb76bc664 in changeUrl (_t1=..., this=0x8539340) at ./terminalpanel.moc:119
#12 TerminalPanel::slotKonsolePartCurrentDirectoryChanged (this=0x8539340, dir=...) at ../../../dolphin/src/panels/terminal/terminalpanel.cpp:193
#13 0xb76bc6f3 in TerminalPanel::qt_static_metacall (_o=0x0, _id=0, _a=0xbf92da48, _c=<optimized out>) at ./terminalpanel.moc:64
#14 0xb5a450f7 in QMetaObject::activate (sender=0x84c1138, m=m@entry=0xad64be90 <Konsole::Part::staticMetaObject>, local_signal_index=local_signal_index@entry=3, argv=argv@entry=0xbf92da48) at kernel/qobject.cpp:3539
#15 0xad64791e in currentDirectoryChanged (_t1=..., this=<optimized out>) at ./Part.moc:191
#16 Konsole::Part::qt_static_metacall (_o=<optimized out>, _id=<optimized out>, _a=0xbf92db28, _c=<optimized out>) at ./Part.moc:95
#17 0xb5a450f7 in QMetaObject::activate (sender=sender@entry=0x875ead8, m=m@entry=0xac0fa0c4 <Konsole::SessionController::staticMetaObject>, local_signal_index=local_signal_index@entry=2, argv=argv@entry=0xbf92db28) at kernel/qobject.cpp:3539
#18 0xac094125 in Konsole::SessionController::currentDirectoryChanged (this=0x875ead8, _t1=...) at ./SessionController.moc:280
#19 0xac09bbc3 in Konsole::SessionController::qt_static_metacall (_o=0x0, _id=0, _a=0xbf92dc28, _c=<optimized out>) at ./SessionController.moc:156
#20 0xb5a450f7 in QMetaObject::activate (sender=sender@entry=0x8516e80, m=m@entry=0xac0f9e90 <Konsole::Session::staticMetaObject>, local_signal_index=local_signal_index@entry=4, argv=argv@entry=0xbf92dc28) at kernel/qobject.cpp:3539
#21 0xac0898a5 in Konsole::Session::currentDirectoryChanged (this=this@entry=0x8516e80, _t1=...) at ./Session.moc:343
#22 0xac089915 in Konsole::Session::updateWorkingDirectory (this=this@entry=0x8516e80) at ../../src/Session.cpp:297
#23 0xac089bcf in Konsole::Session::getDynamicTitle (this=0x8516e80) at ../../src/Session.cpp:992
#24 0xac0954f9 in Konsole::SessionController::snapshot (this=0x875ead8) at ../../src/SessionController.cpp:265
#25 0xac09b7c0 in Konsole::SessionController::qt_static_metacall (_o=0x0, _id=0, _a=0xbf92ddc8, _c=<optimized out>) at ./SessionController.moc:204
#26 0xb5a450f7 in QMetaObject::activate (sender=sender@entry=0x8516e80, m=m@entry=0xac0f9e90 <Konsole::Session::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3539
#27 0xac089605 in Konsole::Session::started (this=this@entry=0x8516e80) at ./Session.moc:317
#28 0xac08d11a in Konsole::Session::run (this=0x8516e80) at ../../src/Session.cpp:515
#29 0xad646906 in Konsole::Part::showShellInDir (this=0x84c1138, dir=...) at ../../src/Part.cpp:166
#30 0xb76bc8c6 in TerminalPanel::showEvent (this=0x8539340, event=0xbf92e244) at ../../../dolphin/src/panels/terminal/terminalpanel.cpp:121
#31 0xb5fe50d8 in QWidget::event (this=0x8539340, event=0xbf92e244) at kernel/qwidget.cpp:8594
#32 0xb5f8b7f4 in QApplicationPrivate::notify_helper (this=0x834e670, receiver=0x8539340, e=0xbf92e244) at kernel/qapplication.cpp:4567
#33 0xb5f922d3 in QApplication::notify (this=0xbf92e510, receiver=receiver@entry=0x8539340, e=e@entry=0xbf92e244) at kernel/qapplication.cpp:4353
#34 0xb6adc1f4 in KApplication::notify (this=0xbf92e510, receiver=0x8539340, event=0xbf92e244) at ../../kdeui/kernel/kapplication.cpp:311
#35 0xb5a2fe4a in QCoreApplication::notifyInternal (this=0xbf92e510, receiver=receiver@entry=0x8539340, event=event@entry=0xbf92e244) at kernel/qcoreapplication.cpp:953
#36 0xb5fe2332 in sendEvent (event=0xbf92e244, receiver=0x8539340) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#37 QWidgetPrivate::show_helper (this=<optimized out>, this@entry=0x83c7228) at kernel/qwidget.cpp:7556
#38 0xb5fe200b in QWidgetPrivate::show_recursive (this=0x83c7228) at kernel/qwidget.cpp:7427
#39 0xb5fe216f in QWidgetPrivate::showChildren (this=this@entry=0x8518370, spontaneous=spontaneous@entry=false) at kernel/qwidget.cpp:7864
#40 0xb5fe2230 in QWidgetPrivate::show_helper (this=<optimized out>, this@entry=0x8518370) at kernel/qwidget.cpp:7503
#41 0xb5fe200b in QWidgetPrivate::show_recursive (this=0x8518370) at kernel/qwidget.cpp:7427
#42 0xb5fe216f in QWidgetPrivate::showChildren (this=this@entry=0x83ee5c0, spontaneous=spontaneous@entry=false) at kernel/qwidget.cpp:7864
#43 0xb5fe2230 in QWidgetPrivate::show_helper (this=<optimized out>) at kernel/qwidget.cpp:7503
#44 0xb5fe42bd in QWidget::setVisible (this=0x84cb998, visible=true) at kernel/qwidget.cpp:7778
#45 0xb766cb9d in show (this=<optimized out>) at /usr/include/qt4/QtGui/qwidget.h:497
#46 DolphinApplication::DolphinApplication (this=0xbf92e510) at ../../../dolphin/src/dolphinapplication.cpp:84
#47 0xb76846be in kdemain (argc=6, argv=0xbf92e5f4) at ../../../dolphin/src/main.cpp:89
#48 0x0804855b in main (argc=6, argv=0xbf92e5f4) at dolphin_dummy.cpp:3

Reproducible: Always
Comment 1 Emmanuel Pescosta 2014-09-29 13:24:12 UTC
Which Dolphin version? I assume 4.14.x?
Comment 2 Thomas Lübking 2014-09-29 14:19:31 UTC
Yes (sorry)
Comment 3 Christoph Feck 2014-10-18 11:43:37 UTC
*** Bug 340082 has been marked as a duplicate of this bug. ***
Comment 4 Frank Reininghaus 2014-10-19 20:59:43 UTC
Instructions from bug 340082:

1. open dolphin and enable terminal panel
2. from konsole run 'kde-open /path/to/directory'

I cannot reproduce the crash with these instructions though, neither in KDE/4.14 nor in master.
Comment 5 Leszek Lesner 2014-10-21 09:46:15 UTC
I confirm the crash. 
Steps I did to reproduce it.

1. Open dolphin and hit f4 to enable the build in konsole
2. Close dolphin
3. Plug in a usb stick 
4. Press open in filemanager in the upcoming notification

This produces a dr.konqi crash dialog. 

All tested on debian with 4.14.0 . 
Also reproducable on Kubuntu 14.04 with 4.14.2
Comment 6 Thomas Lübking 2014-10-21 14:49:41 UTC
I assume that a Qt::QueuedConnection binding to the slot would be sufficient, but cannot reproduce the crash either.
Is anybody running into this able to successfully compile a patch into dolphin?
(For my compile-monkey-user who runs into the crash, the konsole part isn't loaded at all in the self-compiled variant. Something I can't reproduce either...)
Comment 7 Frank Reininghaus 2014-10-22 17:03:55 UTC
(In reply to Thomas Lübking from comment #6)
> I assume that a Qt::QueuedConnection binding to the slot would be
> sufficient

Yes, you're probably right. Alternatively, we can move the connect statement further down, which has the benefit that bug 340233 is also fixed :-)
Comment 8 Frank Reininghaus 2014-10-23 21:22:06 UTC
Git commit 62c7120acd96f44d5290fa0e16ae071584e8ee68 by Frank Reininghaus.
Committed on 23/10/2014 at 21:17.
Pushed by freininghaus into branch 'KDE/4.14'.

Connect to the currentDirectoryChanged signal after the shell setup

This fixes the problem that the view URL may be reset to the Home URL
when opening the Terminal Panel while browsing a remote URL. Moreover,
it fixes crashes that can occur when the signal is received during the
shell setup if the DolphinMainWindow does not have a valid
m_activeViewContainer yet.
Related: bug 340233
REVIEW: 120726
FIXED-IN: 4.14.3

M  +2    -2    dolphin/src/panels/terminal/terminalpanel.cpp

http://commits.kde.org/kde-baseapps/62c7120acd96f44d5290fa0e16ae071584e8ee68
Comment 9 Emmanuel Pescosta 2014-11-13 14:34:47 UTC
*** Bug 340926 has been marked as a duplicate of this bug. ***
Comment 10 Emmanuel Pescosta 2014-11-14 11:06:58 UTC
*** Bug 340952 has been marked as a duplicate of this bug. ***
Comment 11 Frank Reininghaus 2015-03-05 21:53:20 UTC
*** Bug 344872 has been marked as a duplicate of this bug. ***
Comment 12 Emmanuel Pescosta 2015-03-22 18:11:05 UTC
*** Bug 345415 has been marked as a duplicate of this bug. ***
Comment 13 sarah.cipullo 2015-06-01 19:43:10 UTC
Created attachment 92953 [details]
New crash information added by DrKonqi

dolphin (4.14.2) on KDE Platform 4.14.2 using Qt 4.8.6

I downloaded a file and tried to open it clicking on the folder icon that appears when download is over. It always crashes

-- Backtrace (Reduced):
#6  DolphinViewContainer::setAutoGrabFocus (this=0x0, grab=grab@entry=false) at ../../../dolphin/src/dolphinviewcontainer.cpp:222
#7  0x00007f888ae60837 in DolphinMainWindow::slotTerminalDirectoryChanged (this=0x1e055e0, url=...) at ../../../dolphin/src/dolphinmainwindow.cpp:315
#8  0x00007f888ae61449 in DolphinMainWindow::qt_static_metacall (_o=0x1e055e0, _id=0, _a=0x7fffb31b7200, _c=<optimized out>) at ./dolphinmainwindow.moc:197
[...]
#10 0x00007f888ae9a6d1 in changeUrl (_t1=..., this=0x1e735d0) at ./terminalpanel.moc:119
#11 TerminalPanel::slotKonsolePartCurrentDirectoryChanged (this=0x1e735d0, dir=...) at ../../../dolphin/src/panels/terminal/terminalpanel.cpp:193
Comment 14 Emmanuel Pescosta 2015-06-01 19:45:07 UTC
(In reply to sarah.cipullo from comment #13)
> Created attachment 92953 [details]
> New crash information added by DrKonqi
> 
> dolphin (4.14.2) on KDE Platform 4.14.2 using Qt 4.8.6
> 
> I downloaded a file and tried to open it clicking on the folder icon that
> appears when download is over. It always crashes
> 
> -- Backtrace (Reduced):
> #6  DolphinViewContainer::setAutoGrabFocus (this=0x0, grab=grab@entry=false)
> at ../../../dolphin/src/dolphinviewcontainer.cpp:222
> #7  0x00007f888ae60837 in DolphinMainWindow::slotTerminalDirectoryChanged
> (this=0x1e055e0, url=...) at ../../../dolphin/src/dolphinmainwindow.cpp:315
> #8  0x00007f888ae61449 in DolphinMainWindow::qt_static_metacall
> (_o=0x1e055e0, _id=0, _a=0x7fffb31b7200, _c=<optimized out>) at
> ./dolphinmainwindow.moc:197
> [...]
> #10 0x00007f888ae9a6d1 in changeUrl (_t1=..., this=0x1e735d0) at
> ./terminalpanel.moc:119
> #11 TerminalPanel::slotKonsolePartCurrentDirectoryChanged (this=0x1e735d0,
> dir=...) at ../../../dolphin/src/panels/terminal/terminalpanel.cpp:193

Please upgrade to Dolphin 4.14.3
Comment 15 Frank Reininghaus 2015-06-24 19:27:52 UTC
*** Bug 349502 has been marked as a duplicate of this bug. ***
Comment 16 Frank Reininghaus 2015-07-07 19:10:53 UTC
*** Bug 349736 has been marked as a duplicate of this bug. ***
Comment 17 Elvis Angelaccio 2016-12-25 11:43:06 UTC
*** Bug 365159 has been marked as a duplicate of this bug. ***