problem with area loading

Vladimir Prus ghost at
Tue Jun 3 05:05:15 UTC 2008

On Tuesday 03 June 2008 00:25:14 Andreas Pakulat wrote:
> Hi,
> 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.

Thanks for analysing the issue!

> 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) 

There's no harm with creating views for default areas, since those are lazy
views -- since the default area is never actually shown, you never get
actual widgets for those views, so things are OK.

> 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?

There's allAreas() method already. Changing to use it make the crash go away.
However, after that the project view will no longer show up, no matter what
I do. I'll look into that issue later today.

- Volodya

More information about the KDevelop-devel mailing list