Results 1 to 6 of 6

Thread: Crash during sending list from dialog to main window

  1. #1
    Join Date
    Nov 2006
    Posts
    72
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Crash during sending list from dialog to main window

    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)

    Qt Code:
    1. void Search::transferSelectedResults() //Search inherited QDialog
    2. {
    3. int row;
    4. QListWidgetItem * item1;
    5. MTEV_menu * menu=(MTEV_menu *)m_parent;
    6. //MTEV_menu inherited QMain Window
    7.  
    8. ltwLoadTCTS->selectAll();
    9. QList<QString> list;
    10.  
    11. foreach (QListWidgetItem * item, ltwLoadTCTS->selectedItems())
    12. {
    13. list.append(item->text());
    14. row=ltwLoadTCTS->row(item); // ltwLoadTCTS is QListWidget * of Search
    15. item1=ltwLoadTCTS->takeItem(row);
    16. delete item1;
    17. }
    18.  
    19. menu->AddTestItems(list);
    20.  
    21. accept();
    22. }
    To copy to clipboard, switch view to plain text mode 

    this is code for method of qmain window which adds items to it's qlistwidget
    Qt Code:
    1. void MTEV_menu::AddTestItems(QList <QString> &list)
    2. {
    3.  
    4. foreach (QString item, list)
    5. {
    6. if (!isInList(item))
    7. TestCases->addItem(item);
    8. //TestCases are QListWidgetItem * of MTEV_menu
    9. }
    10.  
    11.  
    12. }
    To copy to clipboard, switch view to plain text mode 

    Any comments appreciated

    P.S. Any other suggestions on how to do sending items from qdialog to qmainwindow are also welcomed....
    Last edited by Djony; 23rd November 2006 at 19:38.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Crash during sending list from dialog to main window

    Could you post the backtrace?

  3. #3
    Join Date
    Nov 2006
    Posts
    72
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Crash during sending list from dialog to main window

    How to do that?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Crash during sending list from dialog to main window

    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.

  5. The following user says thank you to jacek for this useful post:

    Djony (23rd November 2006)

  6. #5
    Join Date
    Nov 2006
    Posts
    72
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Crash during sending list from dialog to main window

    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:rocessEvents(QFlags<QEventLoop::ProcessEventsFlag
    >) (this=0x22fca0, flags=0x22fbf0) at kernel/qeventloop.cpp:124
    #22 0x100d38d6 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsF lag>) (
    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)
    -----------------------------------------------------

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Crash during sending list from dialog to main window

    Quote Originally Posted by Djony View Post
    #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.

  8. The following user says thank you to jacek for this useful post:

    Djony (23rd November 2006)

Similar Threads

  1. qt network performance
    By criss in forum Qt Programming
    Replies: 16
    Last Post: 24th July 2006, 10:23
  2. Replies: 3
    Last Post: 23rd July 2006, 19:02
  3. Replies: 3
    Last Post: 31st March 2006, 19:38
  4. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 11:21
  5. Main window
    By Michiel in forum Qt Tools
    Replies: 1
    Last Post: 21st March 2006, 00:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.