PDA

View Full Version : Crash during sending list from dialog to main window



Djony
23rd November 2006, 19:20
Hi, I have crash I can't really understand (and for me it's really dificult to debug Qt in Eclipse on Windows). This is the issue: I have dialog with some Qlistwidget and this dialog needs to send all items from it's qlistwidget to qmain window's list widget. The first time I try to do this, all goes well, but second time (when there are already some items in qmainwindow's qlistwidget) the application crashes.

This is the code for qdialog's method which sends the items to qmain window: (qdialog is child of qmain window, btw)


void Search::transferSelectedResults() //Search inherited QDialog
{
int row;
QListWidgetItem * item1;
MTEV_menu * menu=(MTEV_menu *)m_parent;
//MTEV_menu inherited QMain Window

ltwLoadTCTS->selectAll();
QList<QString> list;

foreach (QListWidgetItem * item, ltwLoadTCTS->selectedItems())
{
list.append(item->text());
row=ltwLoadTCTS->row(item); // ltwLoadTCTS is QListWidget * of Search
item1=ltwLoadTCTS->takeItem(row);
delete item1;
}

menu->AddTestItems(list);

accept();
}

this is code for method of qmain window which adds items to it's qlistwidget

void MTEV_menu::AddTestItems(QList <QString> &list)
{

foreach (QString item, list)
{
if (!isInList(item))
TestCases->addItem(item);
//TestCases are QListWidgetItem * of MTEV_menu
}


}

Any comments appreciated :)

P.S. Any other suggestions on how to do sending items from qdialog to qmainwindow are also welcomed....

jacek
23rd November 2006, 20:11
Could you post the backtrace?

Djony
23rd November 2006, 20:12
How to do that?

jacek
23rd November 2006, 20:19
If you use gdb, do this:
C:\> gdb.exe application.exe
(gdb) run
<application crashes>
(gdb) bt
<the backtrace is here>
Make sure that your application was compiled in debug mode.

Djony
23rd November 2006, 20:28
Hey, thanx for showing me this :)
Here is backtrace :
---------------------------------
(gdb) run
Starting program: application.exe

Program received signal SIGSEGV, Segmentation fault.
0x0411f798 in ?? ()
(gdb) bt
#0 0x0411f798 in ?? ()
#1 0x0043f6fb in MTEV_menu::qt_metacall(QMetaObject::C
this=0x22fd50, _c=InvokeMetaMethod, _id=3, _a=0x22e
at debug/moc_MTEV_menu.cpp:72
#2 0x100eccd9 in QBezier::shifted(QBezier*, int, doubl
at kernel/qobject.cpp:2674
#3 0x100ecfc2 in QMetaObject::activate(QObject*, QMeta
void**) (sender=0x39e92f0, m=0x1077a00, from_local_sign
to_local_signal_index=3, argv=0x22e9e4) at kernel/q
#4 0x00f76f03 in ?? ()
#5 0x00dbcd8b in ?? ()
#6 0x00dbe36b in ?? ()
#7 0x00b9f609 in ?? ()
#8 0x00dbe229 in ?? ()
#9 0x00e42470 in ?? ()
#10 0x00b55ca5 in ?? ()
#11 0x00b547d2 in ?? ()
#12 0x00fa5941 in ?? ()
#13 0x00baf679 in ?? ()
#14 0x00baac1e in ?? ()
#15 0x77d48734 in _libkernel32_a_iname ()
#16 0x77d48816 in _libkernel32_a_iname ()
#17 0x77d489cd in _libkernel32_a_iname ()
---Type <return> to continue, or q <return> to quit---
#18 0x77d48a10 in _libkernel32_a_iname ()
#19 0x100fe225 in QPainter::save() () at kernel/qeventdispatcher_win.cpp:432
#20 0x00ba966c in ?? ()
#21 0x100d37c8 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag
>) (this=0x22fca0, flags=0x22fbf0) at kernel/qeventloop.cpp:124
#22 0x100d38d6 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (
this=0x22fca0, flags=0x22fc80) at kernel/qeventloop.cpp:169
#23 0x100d74c2 in QCoreApplication::exec() ()
at kernel/qcoreapplication.cpp:679
#24 0x00b53ddc in ?? ()
#25 0x00407b12 in qMain(int, char**) (argc=1, argv=0x3d4488)
at src/MTEV_menu.cpp:517
#26 0x004403af in WinMain (instance=0x400000, prevInstance=0x0, cmdShow=10)
at qtmain_win.cpp:105
#27 0x0043ff3a in main ()
(gdb)
-----------------------------------------------------

jacek
23rd November 2006, 20:43
#1 0x0043f6fb in MTEV_menu::qt_metacall(QMetaObject::C
this=0x22fd50, _c=InvokeMetaMethod, _id=3, _a=0x22e
at debug/moc_MTEV_menu.cpp:72
Check that moc_MTEV_menu.cpp file and see what slot Qt tried to invoke.