Reproducable Crash in UIController

Milian Wolff mail at milianw.de
Wed Jun 17 17:09:25 UTC 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?
-- 
Milian Wolff
http://milianw.de




More information about the KDevelop-devel mailing list