Results 1 to 20 of 48

Thread: Program crashes (SIGSEGV)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Posts
    37
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Program crashes (SIGSEGV)

    Hello,

    My program crashes sometimes (SIGSEGV - Segmentation fault). This is (a part of) the code:

    This shows the error message when the connection with the server was broken or stopped.
    Qt Code:
    1. void Window_Login_Busy::show_errors(int sort_error)
    2. {
    3. close();
    4. window_login->show();
    5. progressbar->setValue(0);
    6.  
    7. QString text = "Aanmelden mislukt";
    8. if(sort_error == 1)
    9. text += ": Disconnected from server.";
    10. else if (sort_error == 2)
    11. text += ": Gebruikersnaam of wachtwoord is fout.";
    12.  
    13. err.setIcon(QMessageBox::Warning);
    14. err.setWindowTitle("QQMsn: Error");
    15. err.setText(text);
    16. err.exec();
    17.  
    18. //debug->setData("bla");
    19. }
    To copy to clipboard, switch view to plain text mode 
    and

    Here someone entered the wrong password, I break the connection with the server.
    Qt Code:
    1. while(ssl_sck_dalogin->canReadLine())
    2. {
    3. [...]
    4. else if(line.contains("HTTP/1.1 302 FOUND"))
    5. {
    6. debug->setData("Redirect");
    7.  
    8. break;
    9. }
    10. [...]
    11. }
    To copy to clipboard, switch view to plain text mode 
    and

    This is the emited slot when I close the connection, it uses the standard Qt signal:

    connect(socket, SIGNAL(disconnected()), SLOT(isDisconnected()));

    login_busy->show_errors(1); is the function in the first code I posted.

    Qt Code:
    1. void cmsn::isDisconnected()
    2. {
    3. debug->setData("\nDisconnected from host (Notification server).");
    4.  
    5. if(login_busy->change_lbl)
    6. login_busy->show_errors(1);
    7. }
    To copy to clipboard, switch view to plain text mode 
    When someone enters the wrong password, I get an error dialog with an Ok button, the login screen is showed and the login_busy is closed. But when you close that screen or press the Ok button, the program receives the SIGSEGV signal and crashes.

    gdb says:

    `/home/quinten/QQMsn_build/QQMsn' has changed; re-reading symbols.
    Starting program: /home/quinten/QQMsn_build/QQMsn
    Failed to read a valid object file image from memory.
    [Thread debugging using libthread_db enabled]
    [New Thread -1223088432 (LWP 4881)]
    [New Thread -1225602160 (LWP 4882)]

    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread -1223088432 (LWP 4881)]
    When I don't show an MessageBox, the program does not crash and gdb says:

    Starting program: /home/quinten/QQMsn_build/QQMsn
    Failed to read a valid object file image from memory.
    [Thread debugging using libthread_db enabled]
    [New Thread -1222646064 (LWP 4927)]
    [New Thread -1225159792 (LWP 4928)]
    [Thread -1225159792 (LWP 4928) exited]

    Program exited normally.
    There are some cases where the server closes the connection (e.g. entering a wrong username). In that case, the same slot is emited, the
    MessageBox shows, and when pressing OK, the MessageBox closes and the program doesn't crash.


    Why does my program crash? How can I solve it? I don't understand where the error is, in my ssl class, in my window_login class, in Qt, in OpenSSL or somewhere else? When you need the whole source code, I'll post it.
    Last edited by Voldemort; 9th May 2007 at 20:16.
    Using Qt version 4.3.0

Similar Threads

  1. Porting my program to another windows machine !
    By probine in forum Qt Programming
    Replies: 1
    Last Post: 14th March 2007, 06:46
  2. QT Program debug,GDB on Linux
    By darpan in forum General Programming
    Replies: 1
    Last Post: 26th January 2007, 22:02
  3. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 04:19
  4. Enter key causing program to exit
    By welby in forum Qt Programming
    Replies: 2
    Last Post: 9th March 2006, 16:11
  5. Reading from TCP Socket crashes program
    By OnionRingOfDoom in forum Qt Programming
    Replies: 26
    Last Post: 27th January 2006, 19:32

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.