Qt-interest Archive, August 2007
QTableWidget removeRow seg fault
Message 1 in thread
Hi,
I am using a QTableWidget and removing rows using removeRow, in certain
situations I get a segmentation fault but I dont see what I am doing
wrong. Here is a long backtrace of where it happens:
(gdb) where
#0 0x0101e4a3 in memmove () from /lib/tls/libc.so.6
#1 0x00e6b275 in QListData::remove (this=0x9b243c4, i=163651584) at
tools/qlistdata.cpp:195
#2 0x00e6b526 in QListData::erase (this=0x9b243c4, xi=0x3ffbaaae) at
tools/qlistdata.cpp:260
#3 0x007055b4 in QAbstractItemView::rowsAboutToBeRemoved
(this=0x9a9efe8, parent=@0xbff7b320, start=0, end=0)
at ../../include/QtCore/../../src/corelib/tools/qlist.h:137
#4 0x00704fe5 in QAbstractItemView::qt_metacall (this=0x9a9efe8,
_c=QMetaObject::InvokeMetaMethod, _id=18, _a=0xbff7b270)
at .moc/release-shared/moc_qabstractitemview.cpp:221
#5 0x0072fe8c in QTableView::qt_metacall (this=0x9a9efe8,
_c=QMetaObject::InvokeMetaMethod, _id=49, _a=0xbff7b270)
at .moc/release-shared/moc_qtableview.cpp:102
#6 0x0076708b in QTableWidget::qt_metacall (this=0x9a9efe8,
_c=QMetaObject::InvokeMetaMethod, _id=49, _a=0xbff7b270)
at .moc/release-shared/moc_qtablewidget.cpp:127
#7 0x00f18297 in QMetaObject::activate (sender=0x9b28160,
from_signal_index=10, to_signal_index=10, argv=0xbff7b270) at
kernel/qobject.cpp:3064
#8 0x00f18793 in QMetaObject::activate (sender=0x9b28160, m=0xfaed08,
local_signal_index=6, argv=0xbff7b270) at kernel/qobject.cpp:3123
#9 0x00f35b73 in QAbstractItemModel::rowsAboutToBeRemoved
(this=0x9b28160, _t1=@0xfffffffc, _t2=0, _t3=0)
at .moc/release-shared/moc_qabstractitemmodel.cpp:163
#10 0x00f04a88 in QAbstractItemModel::beginRemoveRows (this=0x9b28160,
parent=@0xbff7b320, first=0, last=0) at
kernel/qabstractitemmodel.cpp:2072
#11 0x00763d30 in QTableModel::removeRows (this=0x9b28160, row=0,
count=1) at
../../include/QtCore/../../src/corelib/kernel/qabstractitemmodel.h:40
#12 0x00760f96 in QTableWidget::removeRow (this=0x9a9efe8, row=0) at
../../include/QtGui/private/../../../src/gui/itemviews/qtablewidget_p.h:
171
#13 0x08059401 in CATEE::BinRangeDialog::deleteRowClicked
(this=0xbff7c8c0) at BinRangeDialog.cc:117
#14 0x0805bbef in CATEE::BinRangeDialog::qt_metacall (this=0xbff7c8c0,
_c=QMetaObject::InvokeMetaMethod, _id=1, _a=0xbff7b8c8) at
moc_BinRangeDialog.cpp:71
#15 0x00f18297 in QMetaObject::activate (sender=0x9b2ca20,
from_signal_index=29, to_signal_index=30, argv=0xbff7b8c8) at
kernel/qobject.cpp:3064
#16 0x00f18575 in QMetaObject::activate (sender=0x9b2ca20, m=0x969540,
from_local_signal_index=2, to_local_signal_index=3, argv=0xbff7b8c8)
at kernel/qobject.cpp:3143
#17 0x007ea5d0 in QAbstractButton::clicked (this=0x9b2ca20, _t1=false)
at .moc/release-shared/moc_qabstractbutton.cpp:180
#18 0x005a7cd6 in QAbstractButtonPrivate::emitClicked (this=0x9b3abf8)
at widgets/qabstractbutton.cpp:515
#19 0x005a8434 in QAbstractButtonPrivate::click (this=0x9b3abf8) at
widgets/qabstractbutton.cpp:508
#20 0x005a8672 in QAbstractButton::mouseReleaseEvent (this=0x9b2ca20,
e=0xbff7c050) at widgets/qabstractbutton.cpp:1085
#21 0x002f9a39 in QWidget::event (this=0x9b2ca20, event=0xbff7c050) at
kernel/qwidget.cpp:6029
#22 0x005a7bf4 in QAbstractButton::event (this=0x9b2ca20, e=0xbff7c050)
at widgets/qabstractbutton.cpp:1047
#23 0x0063edd8 in QPushButton::event (this=0x9b2ca20, e=0xbff7c050) at
widgets/qpushbutton.cpp:650
#24 0x002b24e9 in QApplicationPrivate::notify_helper (this=0x9a99198,
receiver=0x9b2ca20, e=0xbff7c050) at kernel/qapplication.cpp:3536
#25 0x002b308f in QApplication::notify (this=0xbff7e010,
receiver=0x9b2ca20, e=0xbff7c050) at kernel/qapplication.cpp:3235
#26 0x00f07982 in QCoreApplication::notifyInternal (this=0xbff7e010,
receiver=0x9b2ca20, event=0xbff7c050) at kernel/qcoreapplication.cpp:507
#27 0x00310bba in QETWidget::translateMouseEvent (this=0x9b2ca20,
event=0xbff7c5a0) at
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:187
#28 0x0030f989 in QApplication::x11ProcessEvent (this=0xbff7e010,
event=0xbff7c5a0) at kernel/qapplication_x11.cpp:3007
#29 0x00330df5 in x11EventSourceDispatch (s=0x9a9f918, callback=0,
user_data=0x0) at
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:75
#30 0x00af774b in g_main_context_dispatch () from
/usr/lib/libglib-2.0.so.0
#31 0x00af91d2 in g_main_context_acquire () from
/usr/lib/libglib-2.0.so.0
#32 0x00af96b8 in g_main_context_iteration () from
/usr/lib/libglib-2.0.so.0
#33 0x00f2a763 in QEventDispatcherGlib::processEvents (this=0x9a9de48,
flags=Cannot access memory at address 0x1
) at kernel/qeventdispatcher_glib.cpp:323
#34 0x003308fb in QGuiEventDispatcherGlib::processEvents
(this=0x9a9de48, flags=Cannot access memory at address 0x3ffbaaae
) at ../../include/QtCore/../../src/corelib/global/qglobal.h:1754
#35 0x00f06fff in QEventLoop::processEvents (this=0xbff7c870,
flags=Cannot access memory at address 0xfffffffc
) at ../../include/QtCore/../../src/corelib/global/qglobal.h:1754
#36 0x00f07198 in QEventLoop::exec (this=0xbff7c870, flags={i = 0}) at
../../include/QtCore/../../src/corelib/global/qglobal.h:1770
#37 0x006ae0f1 in QDialog::exec (this=0xbff7c8c0) at
../../include/QtCore/../../src/corelib/global/qglobal.h:1755
#38 0x0804f714 in CATEE::MainWindow::editBiologicalButtonClicked
(this=0xbff7de80) at MainWindow.cc:165
#39 0x0805b78a in CATEE::MainWindow::qt_metacall (this=0xbff7de80,
_c=QMetaObject::InvokeMetaMethod, _id=5, _a=0xbff7ce88) at
moc_MainWindow.cpp:98
#40 0x00f18297 in QMetaObject::activate (sender=0x9ad9538,
from_signal_index=29, to_signal_index=30, argv=0xbff7ce88) at
kernel/qobject.cpp:3064
#41 0x00f18575 in QMetaObject::activate (sender=0x9ad9538, m=0x969540,
from_local_signal_index=2, to_local_signal_index=3, argv=0xbff7ce88)
at kernel/qobject.cpp:3143
#42 0x007ea5d0 in QAbstractButton::clicked (this=0x9ad9538, _t1=false)
at .moc/release-shared/moc_qabstractbutton.cpp:180
#43 0x005a7cd6 in QAbstractButtonPrivate::emitClicked (this=0x9ad9550)
at widgets/qabstractbutton.cpp:515
#44 0x005a8434 in QAbstractButtonPrivate::click (this=0x9ad9550) at
widgets/qabstractbutton.cpp:508
#45 0x005a8672 in QAbstractButton::mouseReleaseEvent (this=0x9ad9538,
e=0xbff7d610) at widgets/qabstractbutton.cpp:1085
---Type <return> to continue, or q <return> to quit---
#46 0x002f9a39 in QWidget::event (this=0x9ad9538, event=0xbff7d610) at
kernel/qwidget.cpp:6029
#47 0x005a7bf4 in QAbstractButton::event (this=0x9ad9538, e=0xbff7d610)
at widgets/qabstractbutton.cpp:1047
#48 0x0063edd8 in QPushButton::event (this=0x9ad9538, e=0xbff7d610) at
widgets/qpushbutton.cpp:650
#49 0x002b24e9 in QApplicationPrivate::notify_helper (this=0x9a99198,
receiver=0x9ad9538, e=0xbff7d610) at kernel/qapplication.cpp:3536
#50 0x002b308f in QApplication::notify (this=0xbff7e010,
receiver=0x9ad9538, e=0xbff7d610) at kernel/qapplication.cpp:3235
#51 0x00f07982 in QCoreApplication::notifyInternal (this=0xbff7e010,
receiver=0x9ad9538, event=0xbff7d610) at kernel/qcoreapplication.cpp:507
#52 0x00310bba in QETWidget::translateMouseEvent (this=0x9ad9538,
event=0xbff7db60) at
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:187
#53 0x0030f989 in QApplication::x11ProcessEvent (this=0xbff7e010,
event=0xbff7db60) at kernel/qapplication_x11.cpp:3007
#54 0x00330df5 in x11EventSourceDispatch (s=0x9a9f918, callback=0,
user_data=0x0) at
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:75
#55 0x00af774b in g_main_context_dispatch () from
/usr/lib/libglib-2.0.so.0
#56 0x00af91d2 in g_main_context_acquire () from
/usr/lib/libglib-2.0.so.0
#57 0x00af96b8 in g_main_context_iteration () from
/usr/lib/libglib-2.0.so.0
#58 0x00f2a763 in QEventDispatcherGlib::processEvents (this=0x9a9de48,
flags=Cannot access memory at address 0x1
) at kernel/qeventdispatcher_glib.cpp:323
#59 0x003308fb in QGuiEventDispatcherGlib::processEvents
(this=0x9a9de48, flags=Cannot access memory at address 0x3ffbaaae
) at ../../include/QtCore/../../src/corelib/global/qglobal.h:1754
#60 0x00f06fff in QEventLoop::processEvents (this=0xbff7de20,
flags=Cannot access memory at address 0xfffffffc
) at ../../include/QtCore/../../src/corelib/global/qglobal.h:1754
#61 0x00f07198 in QEventLoop::exec (this=0xbff7de20, flags={i = 0}) at
../../include/QtCore/../../src/corelib/global/qglobal.h:1770
#62 0x00f0bb85 in QCoreApplication::exec () at
../../include/QtCore/../../src/corelib/global/qglobal.h:1755
#63 0x002b1b70 in QApplication::exec () at kernel/qapplication.cpp:3033
#64 0x0804e0a3 in main (argc=1, argv=0xbff7e0b4) at main.cc:9
If you notice on call #11 the row is 0 and count is 1 so I am not
removing a row that does not exist. I also made sure all items had
values in case that was the problem and I still get a segmentation
fault.
Anyone else seeing the same thing or has a solution, is it a known bug?
I am using 4.3.0 on Redhat Enterprise 4.
Thanks,
-Mike
*****************************************************************
This e-mail and any files transmitted with it may be proprietary
and are intended solely for the use of the individual or entity to
whom they are addressed. If you have received this e-mail in
error please notify the sender. Please note that any views or
opinions presented in this e-mail are solely those of the author
and do not necessarily represent those of ITT Corporation. The
recipient should check this e-mail and any attachments for the
presence of viruses. ITT accepts no liability for any damage
caused by any virus transmitted by this e-mail.
*******************************************************************
Message 2 in thread
Hi,
I am using a QTableWidget and removing rows using removeRow, in certain
situations I get a segmentation fault but I dont see what I am doing
wrong. Here is a long backtrace of where it happens:
(gdb) where
#0 0x0101e4a3 in memmove () from /lib/tls/libc.so.6
#1 0x00e6b275 in QListData::remove (this=0x9b243c4, i=163651584) at
tools/qlistdata.cpp:195
#2 0x00e6b526 in QListData::erase (this=0x9b243c4, xi=0x3ffbaaae) at
tools/qlistdata.cpp:260
#3 0x007055b4 in QAbstractItemView::rowsAboutToBeRemoved
(this=0x9a9efe8, parent=@0xbff7b320, start=0, end=0)
at ../../include/QtCore/../../src/corelib/tools/qlist.h:137
#4 0x00704fe5 in QAbstractItemView::qt_metacall (this=0x9a9efe8,
_c=QMetaObject::InvokeMetaMethod, _id=18, _a=0xbff7b270)
at .moc/release-shared/moc_qabstractitemview.cpp:221
#5 0x0072fe8c in QTableView::qt_metacall (this=0x9a9efe8,
_c=QMetaObject::InvokeMetaMethod, _id=49, _a=0xbff7b270)
at .moc/release-shared/moc_qtableview.cpp:102
#6 0x0076708b in QTableWidget::qt_metacall (this=0x9a9efe8,
_c=QMetaObject::InvokeMetaMethod, _id=49, _a=0xbff7b270)
at .moc/release-shared/moc_qtablewidget.cpp:127
#7 0x00f18297 in QMetaObject::activate (sender=0x9b28160,
from_signal_index=10, to_signal_index=10, argv=0xbff7b270) at
kernel/qobject.cpp:3064
#8 0x00f18793 in QMetaObject::activate (sender=0x9b28160, m=0xfaed08,
local_signal_index=6, argv=0xbff7b270) at kernel/qobject.cpp:3123
#9 0x00f35b73 in QAbstractItemModel::rowsAboutToBeRemoved
(this=0x9b28160, _t1=@0xfffffffc, _t2=0, _t3=0)
at .moc/release-shared/moc_qabstractitemmodel.cpp:163
#10 0x00f04a88 in QAbstractItemModel::beginRemoveRows (this=0x9b28160,
parent=@0xbff7b320, first=0, last=0) at
kernel/qabstractitemmodel.cpp:2072
#11 0x00763d30 in QTableModel::removeRows (this=0x9b28160, row=0,
count=1) at
../../include/QtCore/../../src/corelib/kernel/qabstractitemmodel.h:40
#12 0x00760f96 in QTableWidget::removeRow (this=0x9a9efe8, row=0) at
../../include/QtGui/private/../../../src/gui/itemviews/qtablewidget_p.h:
171
#13 0x08059401 in CATEE::BinRangeDialog::deleteRowClicked
(this=0xbff7c8c0) at BinRangeDialog.cc:117
#14 0x0805bbef in CATEE::BinRangeDialog::qt_metacall (this=0xbff7c8c0,
_c=QMetaObject::InvokeMetaMethod, _id=1, _a=0xbff7b8c8) at
moc_BinRangeDialog.cpp:71
#15 0x00f18297 in QMetaObject::activate (sender=0x9b2ca20,
from_signal_index=29, to_signal_index=30, argv=0xbff7b8c8) at
kernel/qobject.cpp:3064
#16 0x00f18575 in QMetaObject::activate (sender=0x9b2ca20, m=0x969540,
from_local_signal_index=2, to_local_signal_index=3, argv=0xbff7b8c8)
at kernel/qobject.cpp:3143
#17 0x007ea5d0 in QAbstractButton::clicked (this=0x9b2ca20, _t1=false)
at .moc/release-shared/moc_qabstractbutton.cpp:180
#18 0x005a7cd6 in QAbstractButtonPrivate::emitClicked (this=0x9b3abf8)
at widgets/qabstractbutton.cpp:515
#19 0x005a8434 in QAbstractButtonPrivate::click (this=0x9b3abf8) at
widgets/qabstractbutton.cpp:508
#20 0x005a8672 in QAbstractButton::mouseReleaseEvent (this=0x9b2ca20,
e=0xbff7c050) at widgets/qabstractbutton.cpp:1085
#21 0x002f9a39 in QWidget::event (this=0x9b2ca20, event=0xbff7c050) at
kernel/qwidget.cpp:6029
#22 0x005a7bf4 in QAbstractButton::event (this=0x9b2ca20, e=0xbff7c050)
at widgets/qabstractbutton.cpp:1047
#23 0x0063edd8 in QPushButton::event (this=0x9b2ca20, e=0xbff7c050) at
widgets/qpushbutton.cpp:650
#24 0x002b24e9 in QApplicationPrivate::notify_helper (this=0x9a99198,
receiver=0x9b2ca20, e=0xbff7c050) at kernel/qapplication.cpp:3536
#25 0x002b308f in QApplication::notify (this=0xbff7e010,
receiver=0x9b2ca20, e=0xbff7c050) at kernel/qapplication.cpp:3235
#26 0x00f07982 in QCoreApplication::notifyInternal (this=0xbff7e010,
receiver=0x9b2ca20, event=0xbff7c050) at kernel/qcoreapplication.cpp:507
#27 0x00310bba in QETWidget::translateMouseEvent (this=0x9b2ca20,
event=0xbff7c5a0) at
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:187
#28 0x0030f989 in QApplication::x11ProcessEvent (this=0xbff7e010,
event=0xbff7c5a0) at kernel/qapplication_x11.cpp:3007
#29 0x00330df5 in x11EventSourceDispatch (s=0x9a9f918, callback=0,
user_data=0x0) at
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:75
#30 0x00af774b in g_main_context_dispatch () from
/usr/lib/libglib-2.0.so.0
#31 0x00af91d2 in g_main_context_acquire () from
/usr/lib/libglib-2.0.so.0
#32 0x00af96b8 in g_main_context_iteration () from
/usr/lib/libglib-2.0.so.0
#33 0x00f2a763 in QEventDispatcherGlib::processEvents (this=0x9a9de48,
flags=Cannot access memory at address 0x1
) at kernel/qeventdispatcher_glib.cpp:323
#34 0x003308fb in QGuiEventDispatcherGlib::processEvents
(this=0x9a9de48, flags=Cannot access memory at address 0x3ffbaaae
) at ../../include/QtCore/../../src/corelib/global/qglobal.h:1754
#35 0x00f06fff in QEventLoop::processEvents (this=0xbff7c870,
flags=Cannot access memory at address 0xfffffffc
) at ../../include/QtCore/../../src/corelib/global/qglobal.h:1754
#36 0x00f07198 in QEventLoop::exec (this=0xbff7c870, flags={i = 0}) at
../../include/QtCore/../../src/corelib/global/qglobal.h:1770
#37 0x006ae0f1 in QDialog::exec (this=0xbff7c8c0) at
../../include/QtCore/../../src/corelib/global/qglobal.h:1755
#38 0x0804f714 in CATEE::MainWindow::editBiologicalButtonClicked
(this=0xbff7de80) at MainWindow.cc:165
#39 0x0805b78a in CATEE::MainWindow::qt_metacall (this=0xbff7de80,
_c=QMetaObject::InvokeMetaMethod, _id=5, _a=0xbff7ce88) at
moc_MainWindow.cpp:98
#40 0x00f18297 in QMetaObject::activate (sender=0x9ad9538,
from_signal_index=29, to_signal_index=30, argv=0xbff7ce88) at
kernel/qobject.cpp:3064
#41 0x00f18575 in QMetaObject::activate (sender=0x9ad9538, m=0x969540,
from_local_signal_index=2, to_local_signal_index=3, argv=0xbff7ce88)
at kernel/qobject.cpp:3143
#42 0x007ea5d0 in QAbstractButton::clicked (this=0x9ad9538, _t1=false)
at .moc/release-shared/moc_qabstractbutton.cpp:180
#43 0x005a7cd6 in QAbstractButtonPrivate::emitClicked (this=0x9ad9550)
at widgets/qabstractbutton.cpp:515
#44 0x005a8434 in QAbstractButtonPrivate::click (this=0x9ad9550) at
widgets/qabstractbutton.cpp:508
#45 0x005a8672 in QAbstractButton::mouseReleaseEvent (this=0x9ad9538,
e=0xbff7d610) at widgets/qabstractbutton.cpp:1085
---Type <return> to continue, or q <return> to quit---
#46 0x002f9a39 in QWidget::event (this=0x9ad9538, event=0xbff7d610) at
kernel/qwidget.cpp:6029
#47 0x005a7bf4 in QAbstractButton::event (this=0x9ad9538, e=0xbff7d610)
at widgets/qabstractbutton.cpp:1047
#48 0x0063edd8 in QPushButton::event (this=0x9ad9538, e=0xbff7d610) at
widgets/qpushbutton.cpp:650
#49 0x002b24e9 in QApplicationPrivate::notify_helper (this=0x9a99198,
receiver=0x9ad9538, e=0xbff7d610) at kernel/qapplication.cpp:3536
#50 0x002b308f in QApplication::notify (this=0xbff7e010,
receiver=0x9ad9538, e=0xbff7d610) at kernel/qapplication.cpp:3235
#51 0x00f07982 in QCoreApplication::notifyInternal (this=0xbff7e010,
receiver=0x9ad9538, event=0xbff7d610) at kernel/qcoreapplication.cpp:507
#52 0x00310bba in QETWidget::translateMouseEvent (this=0x9ad9538,
event=0xbff7db60) at
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:187
#53 0x0030f989 in QApplication::x11ProcessEvent (this=0xbff7e010,
event=0xbff7db60) at kernel/qapplication_x11.cpp:3007
#54 0x00330df5 in x11EventSourceDispatch (s=0x9a9f918, callback=0,
user_data=0x0) at
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:75
#55 0x00af774b in g_main_context_dispatch () from
/usr/lib/libglib-2.0.so.0
#56 0x00af91d2 in g_main_context_acquire () from
/usr/lib/libglib-2.0.so.0
#57 0x00af96b8 in g_main_context_iteration () from
/usr/lib/libglib-2.0.so.0
#58 0x00f2a763 in QEventDispatcherGlib::processEvents (this=0x9a9de48,
flags=Cannot access memory at address 0x1
) at kernel/qeventdispatcher_glib.cpp:323
#59 0x003308fb in QGuiEventDispatcherGlib::processEvents
(this=0x9a9de48, flags=Cannot access memory at address 0x3ffbaaae
) at ../../include/QtCore/../../src/corelib/global/qglobal.h:1754
#60 0x00f06fff in QEventLoop::processEvents (this=0xbff7de20,
flags=Cannot access memory at address 0xfffffffc
) at ../../include/QtCore/../../src/corelib/global/qglobal.h:1754
#61 0x00f07198 in QEventLoop::exec (this=0xbff7de20, flags={i = 0}) at
../../include/QtCore/../../src/corelib/global/qglobal.h:1770
#62 0x00f0bb85 in QCoreApplication::exec () at
../../include/QtCore/../../src/corelib/global/qglobal.h:1755
#63 0x002b1b70 in QApplication::exec () at kernel/qapplication.cpp:3033
#64 0x0804e0a3 in main (argc=1, argv=0xbff7e0b4) at main.cc:9
If you notice on call #11 the row is 0 and count is 1 so I am not
removing a row that does not exist. I also made sure all items had
values in case that was the problem and I still get a segmentation
fault.
Anyone else seeing the same thing or has a solution, is it a known bug?
I am using 4.3.0 on Redhat Enterprise 4.
Thanks,
-Mike
*****************************************************************
This e-mail and any files transmitted with it may be proprietary
and are intended solely for the use of the individual or entity to
whom they are addressed. If you have received this e-mail in
error please notify the sender. Please note that any views or
opinions presented in this e-mail are solely those of the author
and do not necessarily represent those of ITT Corporation. The
recipient should check this e-mail and any attachments for the
presence of viruses. ITT accepts no liability for any damage
caused by any virus transmitted by this e-mail.
*******************************************************************