Results 1 to 7 of 7

Thread: http trouble again, segfaults when no internet

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    46
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Default Re: http trouble again, segfaults when no internet

    It seems like you're deleting some wrong pointer. But I'm just guessing. I haven't tried your code without connection yet, and haven't looked the code deeply neither but, maybe you should take a closer look at Image::httpDone(bool) slot where you're deleting objects.
    Anyways, I agrre with Wysota, you should run your app with gdb and see where it crashes.

    Cheers.
    Kandalf
    There's no place like ~

  2. #2
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 21 Times in 21 Posts

    Default Re: http trouble again, segfaults when no internet

    Hello,

    I tested on a Linux Debian, and here is the backtrace from gdb:

    Qt Code:
    1. Program received signal SIGSEGV, Segmentation fault.
    2. [Switching to Thread -1220528448 (LWP 8604)]
    3. 0xb79b009d in QMetaObject::activate () from /usr/lib/libQtCore_debug.so.4
    4. (gdb) where
    5. #0 0xb79b009d in QMetaObject::activate () from /usr/lib/libQtCore_debug.so.4
    6. #1 0xb79b0a2c in QMetaObject::activate () from /usr/lib/libQtCore_debug.so.4
    7. #2 0xb7a4e171 in QHttp::stateChanged () from /usr/lib/libQtNetwork_debug.so.4
    8. #3 0xb7a4e22a in QHttpPrivate::setState () from /usr/lib/libQtNetwork_debug.so.4
    9. #4 0xb7a4edfd in QHttpPrivate::closeConn () from /usr/lib/libQtNetwork_debug.so.4
    10. #5 0xb7a56f68 in QHttpPrivate::slotError () from /usr/lib/libQtNetwork_debug.so.4
    11. #6 0xb7a592a9 in QHttp::qt_metacall () from /usr/lib/libQtNetwork_debug.so.4
    12. #7 0xb79b05b1 in QMetaObject::activate () from /usr/lib/libQtCore_debug.so.4
    13. #8 0xb79b0a2c in QMetaObject::activate () from /usr/lib/libQtCore_debug.so.4
    14. #9 0xb7a68e94 in QAbstractSocket::error () from /usr/lib/libQtNetwork_debug.so.4
    15. #10 0xb7a6b244 in QAbstractSocketPrivate::startConnecting () from /usr/lib/libQtNetwork_debug.so.4
    16. #11 0xb7a6c859 in QAbstractSocket::qt_metacall () from /usr/lib/libQtNetwork_debug.so.4
    17. #12 0xb7a770f2 in QTcpSocket::qt_metacall () from /usr/lib/libQtNetwork_debug.so.4
    18. #13 0xb79af815 in QObject::event () from /usr/lib/libQtCore_debug.so.4
    19. #14 0xb7b4d8b4 in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui_debug.so.4
    20. #15 0xb7b4e8c9 in QApplication::notify () from /usr/lib/libQtGui_debug.so.4
    21. #16 0xb79a444d in QCoreApplication::sendPostedEvents () from /usr/lib/libQtCore_debug.so.4
    22. #17 0xb7bb5711 in QEventDispatcherX11::processEvents () from /usr/lib/libQtGui_debug.so.4
    23. #18 0xb79a1a24 in QEventLoop::processEvents () from /usr/lib/libQtCore_debug.so.4
    24. #19 0xb79a1c76 in QEventLoop::exec () from /usr/lib/libQtCore_debug.so.4
    25. #20 0xb79a4611 in QCoreApplication::exec () from /usr/lib/libQtCore_debug.so.4
    26. #21 0xb7b4d5d7 in QApplication::exec () from /usr/lib/libQtGui_debug.so.4
    27. #22 0x0804d0a3 in main (argc=1, argv=0xbfee1394) at imgtestdialog.cpp:216
    To copy to clipboard, switch view to plain text mode 

    That doesn't help a lot...

    Guilugi.

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

    Default Re: http trouble again, segfaults when no internet

    I think that the problem is with:
    Qt Code:
    1. delete http;
    2. http = 0;
    To copy to clipboard, switch view to plain text mode 
    It looks like you delete it while there are still some unprocessed events. Since you call Image::deleteLater(), you could omit those two lines.

  4. #4
    Join Date
    Jan 2006
    Location
    N.B. Canada
    Posts
    47
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanked 8 Times in 7 Posts

    Default Re: http trouble again, segfaults when no internet

    Sorry, i was sick with the flu or cold yesturday so haven't been using the computer. Anyway it looks like you guys solved the problem for me. Indeed if I comment out the delete http lines the code works fine. Kinda weird, didn't really think that could be the problem. Should have tried that maybe before posting I guess. thanks all.

    Bojan
    The march of progress:
    C:
    printf("%10.2f", x);
    C++:
    cout << setw(10) << setprecision(2) << showpoint << x;
    Java:
    java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
    formatter.setMinimumFractionDigits(2);
    formatter.setMaximumFractionDigits(2);
    String s = formatter.format(x);
    for (int i = s.length(); i < 10; i++) System.out.print(' ');
    System.out.print(s);

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
  •  
Qt is a trademark of The Qt Company.