kdchart crash

Dag Andersen danders at get2net.dk
Wed Apr 27 07:35:20 BST 2011


Hi,
kplato/plan triggers a crash in kdchart. I've discussed this with Johannes 
Simon earlier but he has not answered my last mail so it would be nice if 
somebody with kdchart karma can have a look at this.

(Ref bug 263429: kplato crashes on clicking File -> New)

(...)
> > #11 0x00007f45453c40f8 in operator[] (this=0x1d8ff90, o=0x0) at
> > ../../include/QtCore/../../src/corelib/tools/qlist.h:464
> > #12 QObjectPrivate::setParent_helper (this=0x1d8ff90, o=0x0) at
> > kernel/qobject.cpp:1970
> > #13 0x00007f4545e50ba3 in QWidgetPrivate::setParent_sys (this=0x1d8ff90,
> > parent=0x0, f=...) at kernel/qwidget_x11.cpp:1162
> > #14 0x00007f4545e06aad in QWidget::setParent (this=0x1d88bc0,
> > parent=<value optimized out>, f=<value optimized out>) at
> > kernel/qwidget.cpp:9993 #15 0x00007f4545e07355 in QWidget::setParent
> > (this=0x1d88bc0, parent=0x0) at kernel/qwidget.cpp:9950
> > #16 0x00007f452f8f93ec in KDChart::AbstractCoordinatePlane::takeDiagram
> > (this=0x1d83590, diagram=0x1d88bc0) at
> > /var/tmp/portage/app-office/koffice-libs-2.3.0/work/koffice-libs-2.3.0/pl
> > ug ins/chartshape/kdchart/src/KDChartAbstractCoordinatePlane.cpp:116
> > 
> > Does Qt maybe not like the diagram->setParent( 0 ); in KD Chart? I would
> > have to take a look at what QObjectPrivate::setParent_helper() does, but
> > I don't have the Qt sources here right now. Another possibility is that
> > it has to do with the destruction order of objects in KD Chart and
> > dangling pointers because of something getting destroyed when the
> > pointer is still in use afterwards. I at least once fixed an issue like
> > that, so if it is this it could have been fixed in the meantime.
(...) 
Finally got it to crash here and traced (more or less) why it crashes:
The cause is a setParent(0) as a result of:
    if ( d->plane )
        d->plane->takeDiagram( this );
in the AbstractDiagram dtor.
The takeDiagram the does diagram->setParent(0) which confuses QObject and 
results in an assert.

I haven't figured out why it does not *always* crashes with *all* compilations 
of qt. Here it crashes with my own build of qt, but not with the kubuntu 
package, both 4.7.1.

Anyways, adding a qDeleteAll( children() ) in ~Chart() seems to solve this 
because  then the Chart is not marked as deleted before it deletes its 
children, so setParent(0) does not confuse QObject.

Could you have look and commit if ok, or find a better solution if possible?
-- 
Mvh.
Dag Andersen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: crash.diff
Type: text/x-patch
Size: 280 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20110427/d06c3c3b/attachment.bin>


More information about the calligra-devel mailing list