Page MenuHomePhabricator

Deletion of PlanarFigures does not work as expected
Closed, ResolvedPublic

Description

T17643 introduced the possibility to delete PlanarFigures in the 4 RenderWindows of the MultiWidget.

Indeed, the PlanarFigure vanishes when pressing <DEL>, but it is NOT deleted!

The DataNode is merely removed from the DataStorage, but neither the DataNode, nor the PlanarFigureInteractor, nor the PlanarFigure itself are actually deleted.
-> It's actually a Memory-Leak!!

What's also quite bad is that this is triggered in the interaction pipeline. So, an event is handled and given to the PlanarFigureInteractor. This interactor removes its DataNode from the DataStorage and thus removes itself from the list of interactors. However, the list of interactors that is currently iterated is supposed to be const!!!

I admit, this seems to work in the workbench environment but in my opinion this is really hacked..

The PlanarFigure or its interactor should not be responsible for deleting the PlanarFigure. In my opinion that's the responsibility of the application, not the dataobject.

Does the workbench have a possibility to define 'global' shortcuts?

Event Timeline

User engelm has pushed new remote branch:

bug-19382-improve-deleting-of-PlanarFigures

[ce327d]: Merge branch 'bug-19382-improve-deleting-of-PlanarFigures'

Merged commits:

2015-10-22 13:56:05 Markus Engel [fa9361]
improved const-correctness in module PlanarFigure


2015-10-22 13:55:45 Markus Engel [07afd3]
added check if figure can be deleted before it's actually removed from dataStorage

I have modified the interactor to check if the figure can actually be removed before doing so.

Caspar wanted to look into the issue of the memory leak so I will assign the ticket to him.

As far as I can tell the data is correctly deleted, albeit later.

a)

  1. Draw a planer figure
  2. Select it in the datamanager
  3. Press delete

-> DataNode Destructor and BaseData Destructor are called

b)

  1. Draw a planer figure
  2. Select it in the multiwidget
  3. Press delete
  4. Do stuff
  5. Either click on the datamanager or do an action that causes a node to be added to it

-> DataNode Destructor and BaseData Destructor are called

So I will close this bug for now.