[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Problem when deleting Containers
From:       zander () kde ! org
Date:       2010-09-06 15:10:37
Message-ID: 201009061710.37886.zander () kde ! org
[Download RAW message or body]

On Sunday 5. September 2010 15.50.20 Cyril Oblikov wrote:
> Hi guys. It seems I found a bug.
> 
> ClipboardProxyShape::~ClipboardProxyShape() *recursively* deletes all
> children of shape which is in the clipboard and then deletes the
> container. If container's destructor deletes some of children directly
> it causes a crash. So copying something after you've already copied
> KoTextOnShapeContainer will cause crash.
> 
> I'm not sure what is the best way to resolve this situation. Deleting
> all children recursively sometimes results in attempts to delete some
> of them twice. Deleting only container results in a memory leak.

A shape that is deleted will remove itself from the container it is in and as 
such the container that deletes a child shape in the destructor can avoid 
deleting it again.  By noticing the child is removed and then setting the 
pointer to 0 so it will not get used later.
-- 
Thomas Zander
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic