Bug 72991

Summary: first accessed window crashes kdevelop
Product: [Unmaintained] kdelibs Reporter: tnagy <tnagy256>
Component: kmdiAssignee: KDevelop Developers <kdevelop-devel>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: improves the kdevelop "view" menu
patch

Description tnagy 2004-01-19 20:57:05 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:          Linux

Open kdevelop, don't load any project. Now type alt+up or choose "first accessed window" (it also works with "last accessed window" or alt+down) and surprize ..

By the way the menu entries first "accessed window" "last accessed window" "switch up" "switch down" and "switch to" are truly evil and should be removed from the view menu. If someone does want shortcuts then let him look in the standard shortcut configuration dialog or in the manual. That features are very easily accessed with the mouse pointer otherwise and not by searching (or getting lost) in the menus.
Comment 1 Sascha Cunz 2004-01-19 21:09:48 UTC
Damn. Just another crashing one...

Seems as if we've forgotton to disconnect somewhere. This is a backtrace after closing all open files and pressing Alt+Up:

#3  <signal handler called>
#4  KMdiMainFrm::activateLastWin() (this=0x816a748) at kmdichildview.h:326
#5  0x08066354 in MainWindow::gotoLastWindow() (this=0xfffffe00)
    at mainwindow.cpp:786
#6  0x08069519 in MainWindow::qt_invoke(int, QUObject*) (this=0x816a748, 
    _id=149, _o=0xbfffea90) at mainwindow.moc:163
#7  0x411f4210 in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /opt/qt3/lib/libqt-mt.so.3
#8  0x411f4044 in QObject::activate_signal(int) ()
   from /opt/qt3/lib/libqt-mt.so.3
#9  0x0808ada0 in MainWindowShare::gotoLastWindow() (this=0xfffffe00)
    at qmetaobject.h:261
#10 0x0808afaa in MainWindowShare::qt_emit(int, QUObject*) (this=0x8172ad8, 
    _id=5, _o=0xfffffe00) at mainwindowshare.moc:209
#11 0x411f4245 in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /opt/qt3/lib/libqt-mt.so.3
#12 0x411f4044 in QObject::activate_signal(int) ()
   from /opt/qt3/lib/libqt-mt.so.3
#13 0x40b427ab in KAction::activated() (this=0xfffffe00) at qmetaobject.h:261
#14 0x40b41d7f in KAction::slotActivated() (this=0xfffffe00)
    at kaction.cpp:1054
#15 0x40b429b1 in KAction::qt_invoke(int, QUObject*) (this=0x81c3c58, _id=14, 
    _o=0xbfffec70) at kaction.moc:181
#16 0x411f4210 in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /opt/qt3/lib/libqt-mt.so.3
#17 0x4150e262 in QSignal::signal(QVariant const&) ()
   from /opt/qt3/lib/libqt-mt.so.3
#18 0x4120e148 in QSignal::activate() () from /opt/qt3/lib/libqt-mt.so.3
#19 0x41193016 in QAccelPrivate::activateAmbiguously(QAccelItem*) ()
   from /opt/qt3/lib/libqt-mt.so.3
Comment 2 Sascha Cunz 2004-01-19 21:11:13 UTC
Does this happen in other ui modes, too?
Comment 3 tnagy 2004-01-19 21:30:52 UTC
Yes, it does.
Comment 4 tnagy 2004-01-19 21:48:33 UTC
Created attachment 4247 [details]
improves the kdevelop "view" menu

This patch is for removing the actions "switch to" "next window", "previous
window" from the menu (and only from the menus).
Comment 5 Sascha Cunz 2004-01-19 23:53:27 UTC
Same BT again with QT-Copy and with -debug:

#4  KMdiMainFrm::activateLastWin() (this=0x81bc360) at kmdichildview.h:326
#5  0x08066354 in MainWindow::gotoLastWindow() (this=0xfffffe00)
    at mainwindow.cpp:786
#6  0x08069519 in MainWindow::qt_invoke(int, QUObject*) (this=0x81bc360, 
    _id=149, _o=0xbfffea90) at mainwindow.moc:163
#7  0x4127acbb in QObject::activate_signal(QConnectionList*, QUObject*) (
    this=0x8196070, clist=0x819df38, o=0xbfffea90) at kernel/qobject.cpp:2359
#8  0x4127ab5b in QObject::activate_signal(int) (this=0x8196070, signal=5)
    at kernel/qobject.cpp:2328
#9  0x0808aef0 in MainWindowShare::gotoLastWindow() (this=0xfffffe00)
    at qmetaobject.h:261
#10 0x0808b0fa in MainWindowShare::qt_emit(int, QUObject*) (this=0x8196070, 
    _id=-1073747312, _o=0xfffffe00) at mainwindowshare.moc:209
#11 0x4127ac8f in QObject::activate_signal(QConnectionList*, QUObject*) (
    this=0x819bec0, clist=0x819bef8, o=0xbfffeb70) at kernel/qobject.cpp:2357
#12 0x4127ab5b in QObject::activate_signal(int) (this=0x819bec0, signal=2)
    at kernel/qobject.cpp:2328
#13 0x40b427ab in KAction::activated() (this=0xfffffe00) at qmetaobject.h:261
#14 0x40b41d7f in KAction::slotActivated() (this=0xfffffe00)
    at kaction.cpp:1054
#15 0x40b429b1 in KAction::qt_invoke(int, QUObject*) (this=0x819bec0, 
    _id=-1073747312, _o=0x81bc360) at kaction.moc:181
#16 0x4127acbb in QObject::activate_signal(QConnectionList*, QUObject*) (
    this=0x81eefd8, clist=0x890c648, o=0xbfffec70) at kernel/qobject.cpp:2359
#17 0x4127ab5b in QObject::activate_signal(int) (this=0x81eefd8, signal=2)
    at kernel/qobject.cpp:2328
#18 0x40e1f9ab in KAccelPrivate::menuItemActivated() (this=0xfffffe00)
    at qmetaobject.h:261
#19 0x40e1c449 in KAccelPrivate::eventFilter(QObject*, QEvent*) (
    this=0x81eefd8, pEvent=0xbffff0e0) at kaccel.cpp:319
#20 0x4127856f in QObject::activate_filters(QEvent*) (this=0x81bc360, 
    e=0xbffff0e0) at kernel/qobject.cpp:902
#21 0x412783ed in QObject::event(QEvent*) (this=0x81bc360, e=0xbffff0e0)
    at kernel/qobject.cpp:735
#22 0x412b2c7b in QWidget::event(QEvent*) (this=0x81bc360, e=0xbffff0e0)
    at kernel/qwidget.cpp:4630
#23 0x4137ac3c in QMainWindow::event(QEvent*) (this=0x81bc360, e=0xbffff0e0)
    at widgets/qmainwindow.cpp:1686
Comment 6 Jens Dagerbo 2004-01-20 12:34:19 UTC
KMDI bug. One would think calling KMdiMainFrm::activateLastWin() should be safe at any time, and not crash when there was no "last window".

That said, I'm all for removing it from the view menu. It contains a lot of clutter with minimal usefulness. 
Comment 7 Jens Dagerbo 2004-01-20 13:10:36 UTC
Created attachment 4252 [details]
patch

This fixes the crash for me. Can anyone verify?
Comment 8 Jens Dagerbo 2004-01-20 20:18:57 UTC
Subject: kdelibs/kmdi

CVS commit by dagerbo: 

Quck fix for bug: 72991

CCMAIL: 72991-done@bugs.kde.org


  M +82 -78    kmdimainfrm.cpp   1.54


--- kdelibs/kmdi/kmdimainfrm.cpp  #1.53:1.54
@@ -2023,4 +2023,6 @@ void KMdiMainFrm::activateFirstWin()
    }
 
+   if ( !activeWindow() ) return;
+
    QDateTime current = activeWindow()->getTimeStamp();
    QMap<QDateTime,KMdiChildView*>::iterator pos(m.find(current));
@@ -2049,4 +2051,6 @@ void KMdiMainFrm::activateLastWin()
    }
 
+   if ( !activeWindow() ) return;
+   
    QDateTime current = activeWindow()->getTimeStamp();
    QMap<QDateTime,KMdiChildView*>::iterator pos(m.find(current));


Comment 9 Jens Dagerbo 2004-01-20 20:21:27 UTC
Should be backported to KDE_3_2_BRANCH.
Comment 10 Lukáš Tinkl 2004-01-28 18:36:35 UTC
Subject: KDE_3_2_BRANCH: kdelibs/kmdi

CVS commit by lukas: 

backport crash fix for #72991

CCMAIL: 72991@bugs.kde.org


  M +82 -78    kmdimainfrm.cpp   1.53.2.1


--- kdelibs/kmdi/kmdimainfrm.cpp  #1.53:1.53.2.1
@@ -2023,4 +2023,6 @@ void KMdiMainFrm::activateFirstWin()
    }
 
+   if ( !activeWindow() ) return;
+
    QDateTime current = activeWindow()->getTimeStamp();
    QMap<QDateTime,KMdiChildView*>::iterator pos(m.find(current));
@@ -2049,4 +2051,6 @@ void KMdiMainFrm::activateLastWin()
    }
 
+   if ( !activeWindow() ) return;
+   
    QDateTime current = activeWindow()->getTimeStamp();
    QMap<QDateTime,KMdiChildView*>::iterator pos(m.find(current));