Fwd: Re: Reproducable Crash in UIController

Milian Wolff mail at milianw.de
Wed Jun 24 21:06:53 UTC 2009


> Milian Wolff, 17.06.2009:
> > Hi, found a reproducable crash. To see it, do the following:
> >
> > Open Kdevelop
> > Open a second main window (shift + ctrl + n)
> > close one of the main windows
> > close kdevelop => crash
> >
> > Why?
> > Thread 1 (Thread 0xb5429710 (LWP 5531)):
> > [KCrash Handler]
> > #6  0xb7c407db in KDevelop::UiController::cleanup (this=0xa151970) at
> > /home/milianw/projects/kde4/kdevplatform/shell/uicontroller.cpp:355
> > #7  0xb7c3c84d in KDevelop::Core::cleanup (this=0xa0ffe00) at
> > /home/milianw/projects/kde4/kdevplatform/shell/core.cpp:247
> > #8  0xb7c2fba6 in ~MainWindow (this=0xa1583d8) at
> > /home/milianw/projects/kde4/kdevplatform/shell/mainwindow.cpp:99
> >
> > In cleanup:
> >
> >      foreach (Sublime::MainWindow* w, mainWindows())
> >          w->saveSettings();
> >
> > Problem:
> > mainWindows() (controlledMainWindows in pointer of Controller) is never
> > cleaned up! I thought it would be an easy fix but had bad luck:
> >
> > I thought I'd just have to add something like
> >
> >
> > void Controller::removeMainWindow(MainWindow* mainWindow)
> > {
> >      int index = d->controlledWindows.indexOf(mainWindow);
> >      Q_ASSERT (index != -1);
> >
> >      d->controlledWindows.removeAt(index);
> >
> >      ///TODO: do I have to delete areas?
> >      d->mainWindowAreas.remove(index);
> > }
> >
> > To controller.cpp and call that from uicontroller->cleanup() but then I
> > get a crash in the qobject_cast in
> >
> >
> > void DocumentSwitcherPlugin::removeMainWindow( QObject* obj )
> > {
> >      Sublime::MainWindow* mainwindow =
> > qobject_cast<Sublime::MainWindow*>( obj );
> >
> > Which I cannot explain. So who fixes that?

Ok, I think I managed to fix this, see attached patch. I also sent a mail
to adymo with a question on how to "properly" fix it in his opinion, since
I have no experience with Sublime.

NOTE: This patch is much simpler than what I tried above.

Essentially it fixes two bugs:

1) It makes sure the list of controlledWindows gets properly reduced when a
mainwindow closes (see my report above and also bug 196414).

2) It fixes the documentswitcherplugin to not call removeMainWindow in the
unload() method since at that point the windows should already be deleted.
And thanks to the (already existing) connection to MainWindow::destroyed()
the removeMainWindow is called whenever needed. This explains / fixes the
crash I explained above after trying to fix the initial bug.

-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: multiwindow_shutdown.crash
Type: text/x-apport
Size: 1505 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090624/861aa54a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090624/861aa54a/attachment.sig>


More information about the KDevelop-devel mailing list