words: strange code KWFrame dtor

Sebastian Sauer mail at dipe.org
Fri Jun 17 18:42:31 BST 2011


Dag Andersen wrote:
> The code indicates that the last frame should delete its frameset. This
> never happens though, as when the frame removes itself from the frameset,
> the frames framset pointer is reset.

The detaching only happens if the frameset still knows about the frame so it 
seems...

> So the question is: is it ok to leave the frameset around?

Good question. That logic was there beforer I touched it and it indeed is a 
very hacky "design". What is "funny" is that the KWFrameLayout keeps pointers 
to the frameset and seems on deleting a frameset they are not detached from 
the KWFrameLayout what would result in dangling pointers...

If we compare that with KWDocument::removeShape which has a simlar logic 
(remove frameset if the last frame is removed) then there we detach it 
explicit from the KWFrameLayout.

The problem is that while I cleaned all that up already quit a lot the logic 
is still rather hacky and somehow unpredictable.

Sicne I am very happy with every line of that logic we can get removed I would 
go as far as to say let's commit and see if we run into new crashes over the 
time. Then we at least have a document/case which we can debug and try to 
understand why it's needed + add some lines of comments to make sure others 
don't run into it again. If it doesn't crash then we got right of some of the 
confusion the code can provide :-)

> If yes, the code should be cleaned up,
> if no, something like the att patch should be applied.

I honestly don't know what is the reason that code is still there :-/



More information about the calligra-devel mailing list