Results 1 to 20 of 50

Thread: Program crashes

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2010
    Posts
    58
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Program crashes

    Hi, when calling this:
    Qt Code:
    1. std::string final = tmp.substr(tmp.find(" "), tmp.length());
    2. m_chan = new Channel(this, QString(final.c_str()), socket);
    3. tabs->addTab(m_chan, QString(final.c_str()));
    To copy to clipboard, switch view to plain text mode 
    the program crahes without a reason. im sure the tmp has a " "
    PS:
    when i debug i get seg fault
    Last edited by Fallen_; 17th September 2010 at 05:30.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Program crashes

    Possible problems:

    tabs = 0
    m_chan = 0
    if socket is a pointer, it can be 0 too.

    So, do a check on all pointers, or check your backtrace to find which pointer is 0

  3. #3
    Join Date
    Aug 2010
    Posts
    58
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Program crashes

    already did, nothing wrong

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Program crashes

    Post your backtrace.

  5. #5
    Join Date
    Aug 2010
    Posts
    58
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Program crashes

    Did you mean this?:
    Signal name: SIGSEGV
    Signal meaning: Segmentation fault
    if not:
    http://pastebin.com/R5uubZPf
    ---The text that you have entered is too long (46227 characters). Please shorten it to 10000 characters long.
    anything else?

  6. #6
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Program crashes

    No, that is the compiled code of a QWidget::setParent function.

    But it might get us closer to the error.
    If your program fails in this function, you're creating a widget with a non valid parent.

    I guess Channel is a widget?
    And the first argument in the constructor is the parent?
    Does "this" exist?

  7. #7
    Join Date
    Aug 2010
    Posts
    58
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Program crashes

    Channel is a widget yes, and "this" exist while calling it and yes the first arguemnt is QWidget

  8. #8
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Program crashes

    I would love to see the backtrace.

    What system are you using? Window, Linux, MacOs, ... ?
    What IDE are you using? Qt Creator, ... ?

  9. #9
    Join Date
    Aug 2010
    Posts
    58
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Program crashes

    Windows, Qt creator (to debug), and Qt Command Line to compile. how do i get the backtrace?

  10. #10
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Program crashes

    In Qt Creator, in stead of running the program normally, run the program in the debugger.
    When it crashes, go to the stack view (should be the list on the left I think), it should contain the backtrace.

  11. #11
    Join Date
    Aug 2010
    Posts
    58
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Program crashes

    nope, cant see anything

Similar Threads

  1. qstringlist array crashes program
    By chrisb123 in forum Newbie
    Replies: 4
    Last Post: 23rd October 2009, 15:03
  2. Program crashes on creating new dialog
    By eekhoorn12 in forum Qt Programming
    Replies: 2
    Last Post: 11th June 2009, 11:52
  3. program crashes (QtTestRunner)
    By fmariusd in forum Qt Programming
    Replies: 1
    Last Post: 15th December 2008, 09:27
  4. Program crashes (SIGSEGV)
    By Voldemort in forum Qt Programming
    Replies: 47
    Last Post: 21st May 2007, 20:09
  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.