problem with area loading

Andreas Pakulat apaku at
Mon Jun 2 20:25:14 UTC 2008


I've got a crash here when closing the last project and it appears to
show a problem when loading areas from configurations.

The problem is as follows. UiController first creates a toolview on each
"default" area (obtained via its areas() function), this creates an
instance of the "Projects" toolview. 

Then a few lines down in loadAllAreas it creates a new instance of the
same type (this will be the actual instance that is going to be put into
the mainwindow - AFAIK), however it doesn't keep a reference to this
area anywhere. Nevertheless all toolviews that kdevelop knows about are
also created for this area. Now there are 2 "Projects" toolviews, one on
the default area and another on this instance. Also the ToolDocument
knows now it has two views.

Here comes the problem: When closing the last project, the
projectmanagerview plugin is unloaded and thus asks the UiController to
remove its toolviews. UiController iterates over areas() to do that, but
this means it only removes views from default areas, not from the actual
instance areas. In the end this causes a crash as below, because due to
delete's and deleteLater() the widgets (provided by the plugin) are long
gone when there's still a toolview for it.

Now the questions I have is: Does it even make sense to create actual
toolviews for a given "default" area? As far as I can see those are
never used, except for creating new area instances that are then shown,
so maybe during this creation the toolviews should be added (which
wouldn't actually fix the bug as the default area toolview is already
deleted properly) 

And I guess UiController also needs to keep track of the area instances
it creates from config files, the question is should they be added to
the areas() list or to a separate list?

Here's the backtrace:

#0  0xb625814a in Sublime::View::hasWidget (this=0xbfdaa48c)
    at /home/andreas/KDE-work/4.0/kdevplatform/sublime/view.cpp:64
#1  0xb624e228 in Sublime::Area::walkToolViews<Sublime::ToolWidgetFinder> (this=0x818c150,
    op=@0xbfdaa48c, positions=@0xbfdaa49c)
    at /home/andreas/KDE-work/4.0/kdevplatform/sublime/areawalkers.h:59
#2  0xb624bbb2 in Sublime::Controller::eventFilter (this=0x80f96e0, obj=0x895af48, ev=0xbfdaaa84)
    at /home/andreas/KDE-work/4.0/kdevplatform/sublime/controller.cpp:343
#3  0xb74ba76b in QCoreApplicationPrivate::sendThroughApplicationEventFilters ()
   from /home/andreas/qt-copy/lib/
#4  0xb6936120 in QApplicationPrivate::notify_helper () from /home/andreas/qt-copy/lib/
#5  0xb6936dfb in QApplication::notify () from /home/andreas/qt-copy/lib/
#6  0xb78a1c83 in KApplication::notify (this=0xbfdab25c, receiver=0x895af48, event=0xbfdaaa84)
    at /home/andreas/KDE-work/4.0/kdelibs/kdeui/kernel/kapplication.cpp:311
#7  0xb74bc312 in QCoreApplication::notifyInternal () from /home/andreas/qt-copy/lib/
#8  0xb6942153 in QCoreApplication::sendSpontaneousEvent ()
   from /home/andreas/qt-copy/lib/
#9  0xb693ac06 in QApplicationPrivate::sendMouseEvent ()
   from /home/andreas/qt-copy/lib/
#10 0xb69b2dc8 in QETWidget::translateMouseEvent () from /home/andreas/qt-copy/lib/
#11 0xb69b0862 in QApplication::x11ProcessEvent () from /home/andreas/qt-copy/lib/
#12 0xb69db508 in x11EventSourceDispatch () from /home/andreas/qt-copy/lib/
#13 0xb5ee7978 in g_main_context_dispatch () from /usr/lib/
#14 0xb5eeabce in ?? () from /usr/lib/
#15 0x08062110 in ?? ()
#16 0x00000000 in ?? ()

It looks as if the actual Sublime::View isn't deleted, despite the
view->deleteLater() in UiController::removeToolView().

Any hints as to why or where to start digging are appreciated.


Don't read everything you believe.

More information about the KDevelop-devel mailing list