Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, November 2005
QListView::takeItem() crashes in Qt 3.3.5


Message 1 in thread

Ever since I upgraded to Qt 3.3.5 I get frequent crashes in several
programmes. The backtrace always leads to the QListView::takeItem()
function.
I checked the differences between 3.3.4 and 3.3.5 and some code was changed
in takeItem(), though I couldn't figure out where the bug was.
I saw a couple of other complaints about this issue on the web. Has anyone
else experienced this problem?

Elad


Message 2 in thread

On Friday 04 November 2005 15:20, Elad Lahav wrote:
> Ever since I upgraded to Qt 3.3.5 I get frequent crashes in several
> programmes. The backtrace always leads to the QListView::takeItem()
> function.
> I checked the differences between 3.3.4 and 3.3.5 and some code was
> changed in takeItem(), though I couldn't figure out where the bug was.
> I saw a couple of other complaints about this issue on the web. Has
> anyone else experienced this problem?
>
> Elad

Hi,

this just came up in the kde-devel mailing list:

=========================

Hi,

I finally figure out why kxmame mysteriously crashes using qt 3.3.5. This
is because QListView::clear() method doesn't reset d->highlighted to NULL.

This means that after a few tries of clearing and repopulating the item
list, d->highlighted might point to an invalid location. When
QListViewItem::takeItem is called, d->highlighted is used and causes
crash. Remarkably, due to the way it's coded, this bug doesn't appear in
Qt 3.3.4.

I included the fix patch below for your information. I don't want to
subscribe to another qt-devel list to send this bug info. So if anyone
here can help sending this patch to the proper place, please do.

Thanks a lot,
Toan


diff -uBbr qt-x11-free-3.3.5-old/src/widgets/qlistview.cpp
qt-x11-free-3.3.5/src/widgets/qlistview.cpp
--- qt-x11-free-3.3.5-old/src/widgets/qlistview.cpp     2005-09-02
05:43:15.000000000 -0700
+++ qt-x11-free-3.3.5/src/widgets/qlistview.cpp 2005-11-04
04:07:40.000000000 -0800
@@ -3231,6 +3231,7 @@
     d->focusItem = 0;
     d->selectAnchor = 0;
     d->pressedItem = 0;
+    d->highlighted = 0;

     // if it's down its downness makes no sense, so undown it
     d->buttonDown = FALSE;

=========================