[Qt-interest] Potential bug in QTreeWidgetItemIterator ctor

Dan Furlani dan.furlani at e-cortex.com
Thu May 12 05:05:41 CEST 2011


My application is crashing in this code, since the item->view is null:

QTreeWidgetItemIterator::QTreeWidgetItemIterator(QTreeWidgetItem *item,
IteratorFlags flags)
    : d_ptr(new QTreeWidgetItemIteratorPrivate(
                this, qobject_cast<QTreeModel*>(item->view->model()))),
      current(item), flags(flags)

The crash actually occurs when QAbstractItemView::model() calls d_func()
calls qGetPtrHelper() calls QScopedPointer<...>::data().

Is this something that should be fixed in Qt or in my code?  Just wondering
if it's valid for my code to be providing a QTreeWidgetItem with a null view
member.  QTreeWidgetItem::view is private so I'm not even sure how I would
fix this in my application's code.

I found a bug report with a similar stack trace, in another application:
http://www.mail-archive.com/kdepim-bugs@kde.org/msg39604.html

Maybe not a common bug, but not a one-off either I guess.

Thanks
-dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110511/853c47f7/attachment.html 


More information about the Qt-interest-old mailing list