Qt-interest Archive, August 2006
BUG : ASSERT failure in QVector<T>
Message 1 in thread
Hello,
I have a problem in when trying to remove an Item From a QTreeWidget
using takeTopLevelItem(...).
I got the following error :
ASSERT failure in QVector<T>::at: "index out of range", file
../../include/QtCore/../../src/corelib/tools/qvector.h, line 213
The backtrace of gdb return this :
#0 0xb73b87c7 in raise () from /lib/tls/libc.so.6
#1 0xb73ba06b in abort () from /lib/tls/libc.so.6
#2 0xb761ba8b in qt_message_output (msgType=QtFatalMsg,
buf=0xbf8febd0 "ASSERT failure in QVector<T>::at: \"index out of
range\", file ../../include/QtCore/../../src/corelib/tools/qvector.h,
line 213") at global/qglobal.cpp:1931
#3 0xb761bae9 in qFatal (msg=0xb770a67c "ASSERT failure in %s: \"%s\",
file %s, line %d") at global/qglobal.cpp:2147
#4 0xb761bb2e in qt_assert_x (where=0xb7d0828a "QVector<T>::at",
what=0xb7d08277 "index out of range",
file=0xb7d08240
"../../include/QtCore/../../src/corelib/tools/qvector.h", line=213) at
global/qglobal.cpp:1699
#5 0xb7c816db in QVector<QTreeViewItem>::at (this=0x811f3a4, i=0) at
../../include/QtCore/../../src/corelib/tools/qvector.h:213
#6 0xb7c7c774 in QTreeView::mouseDoubleClickEvent (this=0x810e098,
event=0xbf901520) at itemviews/qtreeview.cpp:1111
#7 0xb78f7722 in QWidget::event (this=0x810e098, event=0xbf901520) at
kernel/qwidget.cpp:4997
#8 0xb7b6010e in QFrame::event (this=0x810e098, e=0xbf901520) at
widgets/qframe.cpp:599
#9 0xb7be9595 in QAbstractScrollArea::viewportEvent (this=0x810e098,
e=0xbf901520) at widgets/qabstractscrollarea.cpp:478
#10 0xb7c50cec in QAbstractItemView::viewportEvent (this=0x810e098,
event=0xbf901520) at itemviews/qabstractitemview.cpp:970
#11 0xb7beacab in QAbstractScrollAreaPrivate::viewportEvent
(this=0x811f1d8, e=0xbf901520) at widgets/qabstractscrollarea.cpp:93
#12 0xb7beac2f in QAbstractScrollAreaViewport::event (this=0x80eafc8,
e=0xbf901520) at widgets/qabstractscrollarea.cpp:105
#13 0xb78a5d27 in QApplicationPrivate::notify_helper (this=0x80691f0,
receiver=0x80eafc8, e=0xbf901520) at kernel/qapplication.cpp:3175
#14 0xb78a6823 in QApplication::notify (this=0xbf901ed8,
receiver=0x80eafc8, e=0xbf901520) at kernel/qapplication.cpp:2905
#15 0xb78af531 in QCoreApplication::sendSpontaneousEvent
(receiver=0x80eafc8, event=0xbf901520)
at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:176
#16 0xb7912442 in QETWidget::translateMouseEvent (this=0x80eafc8,
event=0xbf9018ec) at kernel/qapplication_x11.cpp:3615
#17 0xb79100dd in QApplication::x11ProcessEvent (this=0xbf901ed8,
event=0xbf9018ec) at kernel/qapplication_x11.cpp:2725
#18 0xb7925f56 in QEventDispatcherX11::processEvents (this=0x8074890,
flags=@0xbf901994) at kernel/qeventdispatcher_x11.cpp:112
#19 0xb76c76f3 in QEventLoop::processEvents (this=0xbf901a18,
flags=@0xbf9019cc) at kernel/qeventloop.cpp:124
#20 0xb76c7898 in QEventLoop::exec (this=0xbf901a18, flags=@0xbf901a20)
at kernel/qeventloop.cpp:169
#21 0xb76cbe96 in QCoreApplication::exec () at
kernel/qcoreapplication.cpp:679
#22 0xb78a7b0e in QApplication::exec () at kernel/qapplication.cpp:2720
#23 0x0805ac0c in main (argc=1, argv=0xbf901f84) at main.cpp:45
Aparentlly this error only happend when trying to remove the last item
of the list.
I think this is a bug from Qt. Anyone can help me ?
I'm using QT v4.4.4-1 running on a Linux Debian Etch.
Thank you
--
[ signature omitted ]
Message 2 in thread
"higestromm" <higestromm@xxxxxxx> wrote in message
news:44F204E5.1010103@xxxxxxxxxx
> Hello,
>
> I have a problem in when trying to remove an Item From a QTreeWidget using
> takeTopLevelItem(...).
You're likely trying to delete an item inside of an event
triggered by double clicking on the item. You can
use deleteLater() on the item instead of delete.
--
[ signature omitted ]
Message 3 in thread
Apparently you have find my problem but only QObject can use
deleteLater() and QTreeWidgetItem do not inherit from QObject :/
I've search on all method in QTreeWidgetItem class but no one apear to
do an equivalence of deleteLater().
Is there any way to remove à QTreeWidgetItem with those conditions ?
Duane Hebert wrote:
> "higestromm" <higestromm@xxxxxxx> wrote in message
> news:44F204E5.1010103@xxxxxxxxxx
>
>> Hello,
>>
>> I have a problem in when trying to remove an Item From a QTreeWidget using
>> takeTopLevelItem(...).
>>
>
> You're likely trying to delete an item inside of an event
> triggered by double clicking on the item. You can
> use deleteLater() on the item instead of delete.
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
>
>
--
[ signature omitted ]
Message 4 in thread
"higestromm" <higestromm@xxxxxxx> wrote in message
news:44F21275.4040904@xxxxxxxxxx
> Apparently you have find my problem but only QObject can use deleteLater()
> and QTreeWidgetItem do not inherit from QObject :/
>
> I've search on all method in QTreeWidgetItem class but no one apear to do
> an equivalence of deleteLater().
>
> Is there any way to remove à QTreeWidgetItem with those conditions ?
Right. I got around a similar problem using a single shot timer.
Creating a single shot timer with a timeout of 0 is guaranteed to
fire when the event stack is done. What I did was to make
a class member pointer to the item. Then create a slot that deletes
this item if it's not null. In the double click event, create a static
single shot timer and connect it to this slot.
HTH
--
[ signature omitted ]
Message 5 in thread
Duane Hebert wrote:
> Right. I got around a similar problem using a single shot timer.
> Creating a single shot timer with a timeout of 0 is guaranteed to
> fire when the event stack is done. What I did was to make
> a class member pointer to the item. Then create a slot that deletes
> this item if it's not null. In the double click event, create a static
> single shot timer and connect it to this slot.
Great :) This is working for me.
This is a very strange method but the one that works so : THANK YOU
--
[ signature omitted ]
Message 6 in thread
"higestromm" <higestromm@xxxxxxx> wrote in message
news:44F341CC.9090702@xxxxxxxxxx
> Duane Hebert wrote:
>
> > Right. I got around a similar problem using a single shot timer.
> > Creating a single shot timer with a timeout of 0 is guaranteed to
> > fire when the event stack is done. What I did was to make
> > a class member pointer to the item. Then create a slot that deletes
> > this item if it's not null. In the double click event, create a static
> > single shot timer and connect it to this slot.
>
> Great :) This is working for me.
> This is a very strange method but the one that works so : THANK YOU
No problem. In most of my GUIs, I provide a delete button
that removes the selected item instead of deleting it on
a double click.
--
[ signature omitted ]
Message 7 in thread
On 27.08.06 22:47:33, higestromm wrote:
> Aparentlly this error only happend when trying to remove the last item of the
> list.
>
> I think this is a bug from Qt. Anyone can help me ?
Then report it to qt-bugs <at> trolltech.com.
> I'm using QT v4.4.4-1 running on a Linux Debian Etch.
Wow, where did you get that version? Will Etch really take that long to
be released?
*Just kidding*, I guess you mean 4.1.4. You should also report the bug
against Debian's bug tracking system, this is most easily done via the
reportbug tool (package has the same name).
And last but not least: If you send a report like this, always include a
minimal compilable example to reproduce the problem.
Andreas
--
[ signature omitted ]
Message 8 in thread
Andreas Pakulat wrote:
> On 27.08.06 22:47:33, higestromm wrote:
>
>> Aparentlly this error only happend when trying to remove the last item of the
>> list.
>>
>> I think this is a bug from Qt. Anyone can help me ?
>>
>
> Then report it to qt-bugs <at> trolltech.com.
>
I post here first because I'm not sure... maybe this is not a bug.
>
>> I'm using QT v4.4.4-1 running on a Linux Debian Etch.
>>
>
> Wow, where did you get that version? Will Etch really take that long to
> be released?
>
> *Just kidding*, I guess you mean 4.1.4. You should also report the bug
> against Debian's bug tracking system, this is most easily done via the
> reportbug tool (package has the same name).
>
Yes I made a mistake :) this is the v4.1.4-1
> And last but not least: If you send a report like this, always include a
> minimal compilable example to reproduce the problem.
>
My project is really big and I can't reproduce this bug with a small
example :/.
However I try to give the more information possible.
> Andreas
>
>
Thank You
--
[ signature omitted ]
Message 9 in thread
"Andreas Pakulat" <apaku@xxxxxx> wrote in message
news:20060827213342.GA11536@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> On 27.08.06 22:47:33, higestromm wrote:
>> Aparentlly this error only happend when trying to remove the last item of
>> the
>> list.
>>
>> I think this is a bug from Qt. Anyone can help me ?
>
> Then report it to qt-bugs <at> trolltech.com.
I'm not at the office at the moment but ISTR that
the documentation warns against deleting items in
events fired by the items so I don't think it's a bug.
--
[ signature omitted ]