PDA

View Full Version : segv error in signal



Sheng
7th April 2009, 22:53
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

talk2amulya
7th April 2009, 23:14
have u tested this on different platforms?

marcel
7th April 2009, 23:41
Can you post the stack trace?

lni
8th April 2009, 04:15
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"...

spirit
8th April 2009, 07:02
maybe you pass invalid pointer in QObject::connect?
could you show us compilable code?

Sheng
8th April 2009, 16:24
have u tested this on different platforms?

No, it can only be tested on the target device, which run linux debian.


Can you post the stack trace?

When I use gdb to run the application, I never see segv error.


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.


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

talk2amulya
8th April 2009, 18:15
hey, do you mind sharing some code/psuedocode of how ur code is, how u create objects, so its more clearer

Sheng
8th April 2009, 19:14
hey, do you mind sharing some code/psuedocode of how ur code is, how u create objects, so its more clearer



QWindow1::QWindow1()
{
setupUi(this);
QDialog1 *pDialog=new QDialog1;
...
connect(pDialog,SIGNAL(mysignal()),this,SLOT(funct ion1()));
}


in QDialog1:


QDialog1::QDialog1()
{
setupUi(this);
connect(pButton1,SIGNAL(clicked()),this,SLOT(runBu tton1()));
...
}

void QDialog1::runButton1()
{
emit mysignal();
}