[Uml-devel] Segfault on document close

Achim Spangler Achim.Spangler at mnet-online.de
Fri Dec 1 12:37:20 UTC 2006


Hi again,
I tried the explicit deletion of m_pToolBarStateFactory before the UMLView 
destructor deletes the QCanvas.
AND it WORKS!

So I get no further segfaults on Document Close.

So please merge the attached small patch (just 2 new lines in UMLView 
destruct),
Achim
Am Donnerstag, 30. November 2006 20:36 schrieb Achim Spangler:
> Hi,
>
> I have currently very often a segfault on document close.
>
> The relevant part of stack trace:
> [KCrash handler]
> #6  0x00000049 in ?? ()
> #7  0xb7137932 in QGList::clear () from /usr/lib/libqt-mt.so.3
> #8  0x0816a336 in QPtrList<QCanvasLine>::~QPtrList ()
> #9  0x08190ab5 in ToolBarStateArrow::~ToolBarStateArrow ()
> #10 0xb6e701c3 in QWidget::~QWidget () from /usr/lib/libqt-mt.so.3
> #11 0xb6f70acc in QScrollView::~QScrollView () from /usr/lib/libqt-mt.so.3
> #12 0xb706c7b8 in QCanvasView::~QCanvasView () from /usr/lib/libqt-mt.so.3
> #13 0x081c0d44 in UMLView::~UMLView ()
>
>
> I have the impression, that ToolBarStateArrow::~ToolBarStateArrow() does
> implicitly call QPtrList<QCanvasLine>::~QPtrList ( QPtrList<QCanvasLine>
> m_selectionRect). The m_selectionRect has been set with
>
> m_selectionRect.setAutoDelete(true);
>
> to automatically delete the pointed QCanvasLine objects.
>
> The problem:
> The UMLView::~UMLView() ((#13)) calls "delete canvas();" before, so that
> _all_
>
> items which belong to the canvas are deleted immediately:
> >From Qt-Doc:
>
> QCanvas::~QCanvas () [virtual]
>  Destroys the canvas and all the canvas's canvas items.
>
>
> The QCanvasLine are obiously also part of the containing QCanvas, so that
> its destructor deletes them already. Therefore the later destructor of
> QPtrList<QCanvasLine> goes "mad".
>
> My suggestion:
> Call "m_selectionRect.setAutoDelete(false);" in
> ToolBarStateArrow::~ToolBarStateArrow().
> OR
> Explicitly destroy ToolBarStateArrow _before_ "delete canvas" is called.
> Therefore call
> "delete m_pToolBarStateFactory"
> in UMLView::~UMLView() _BEFORE_ "delete canvas" is called.
>
> I'll try the latter approach for myself.
>
> Does anyone have a better idea?
>
> Thanks,
> Achim
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Uml-devel mailing list
> umbrello-devel at kde.org
> https://mail.kde.org/mailman/listinfo/umbrello-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FixSegfaultOnDocumentCloseInToolbarStateArrow.diff
Type: text/x-diff
Size: 485 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/umbrello-devel/attachments/20061201/73125049/attachment.bin>


More information about the umbrello-devel mailing list