Results 1 to 8 of 8

Thread: segv error in signal

  1. #1
    Join Date
    Sep 2008
    Location
    New York
    Posts
    90
    Thanks
    13
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default segv error in signal

    I have a view called QWindow1, in its constructor, it generate a dialog object called QDialog1; In Dialog, I will send a signal to QWindow1 to run a function. At this time, there is a segv error. It comes occasionally, once every 30 times.
    The function itself should be fine since it is tested thousands of times.
    Is there any design error for the such kind of message passing?
    Thanks for any advice

  2. #2
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: segv error in signal

    have u tested this on different platforms?

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: segv error in signal

    Can you post the stack trace?

  4. #4
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: segv error in signal

    Is the function a virtual function? Virtual function does not work in constructor coz there is no v-table yet...

    Also make sure all initialization has been completed because the object is still "under construction"...

  5. #5
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: segv error in signal

    maybe you pass invalid pointer in QObject::connect?
    could you show us compilable code?
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  6. #6
    Join Date
    Sep 2008
    Location
    New York
    Posts
    90
    Thanks
    13
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: segv error in signal

    Quote Originally Posted by talk2amulya View Post
    have u tested this on different platforms?
    No, it can only be tested on the target device, which run linux debian.

    Quote Originally Posted by marcel View Post
    Can you post the stack trace?
    When I use gdb to run the application, I never see segv error.

    Quote Originally Posted by lni View Post
    Is the function a virtual function? Virtual function does not work in constructor coz there is no v-table yet...

    Also make sure all initialization has been completed because the object is still "under construction"...
    Since most of the time the application works fine, I think it's not the constructor issue. The function itself is not virtual.

    Quote Originally Posted by spirit View Post
    maybe you pass invalid pointer in QObject::connect?
    could you show us compilable code?
    As I said, it works in most of times, so I think it can not happen that I pass invalid pointer.

    To solve this, I initialize the dialog object out of QWindow1, then it seems work fine. Any thought? thanks

  7. #7
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: segv error in signal

    hey, do you mind sharing some code/psuedocode of how ur code is, how u create objects, so its more clearer

  8. #8
    Join Date
    Sep 2008
    Location
    New York
    Posts
    90
    Thanks
    13
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: segv error in signal

    Quote Originally Posted by talk2amulya View Post
    hey, do you mind sharing some code/psuedocode of how ur code is, how u create objects, so its more clearer
    Qt Code:
    1. QWindow1::QWindow1()
    2. {
    3. setupUi(this);
    4. QDialog1 *pDialog=new QDialog1;
    5. ...
    6. connect(pDialog,SIGNAL(mysignal()),this,SLOT(function1()));
    7. }
    To copy to clipboard, switch view to plain text mode 

    in QDialog1:
    Qt Code:
    1. QDialog1::QDialog1()
    2. {
    3. setupUi(this);
    4. connect(pButton1,SIGNAL(clicked()),this,SLOT(runButton1()));
    5. ...
    6. }
    7.  
    8. void QDialog1::runButton1()
    9. {
    10. emit mysignal();
    11. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. pthread instead QThread
    By brevleq in forum Qt Programming
    Replies: 8
    Last Post: 23rd December 2008, 08:16
  2. Connection of custon signals/slots
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2008, 08:04
  3. Possible signal mapper problem
    By MarkoSan in forum Qt Programming
    Replies: 13
    Last Post: 25th January 2008, 14:11
  4. Replies: 2
    Last Post: 17th May 2006, 22:01

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.