PDA

View Full Version : The inferior stopped because it received signal from the Operating System



krisztiantobias
22nd April 2011, 19:33
I create some comboBox with designer, and I append them to te comBoList (<QCombobox*>).

comboList.append(ui->comboBox_30);
comboList.append(ui->comboBox_19);

but if I want use connect:

for(int i=0; i<15; i++){ connect(comboList.at(i),SIGNAL(currentIndexChanged (int)),this,SLOT(this->comboChange()));
}

I get this error message:
http://oi56.tinypic.com/nn1l07.jpg

SixDegrees
22nd April 2011, 22:14
What makes you think there are 15 items in the list? You don't check anywhere, or use a more sensible termination test like the list's size. Did you bother running this in a debugger, or using simple print statements, to find out exactly where in the loop the failure is occuring?

krisztiantobias
23rd April 2011, 09:44
I have exactly 15 buttons in the list, not that's the problem :)

stampede
23rd April 2011, 10:17
I have exactly 15 buttons in the list
But you've hardcoded it, that's really bad habit, better use the count() method:


for(int i=0; i<comboList.count(); i++){
connect(comboList.at(i),SIGNAL(currentIndexChanged (int)),this,SLOT(this->comboChange()));
}

I agree with SixDegrees, add print (qDebug()) statements to know where it fails exactly.

krisztiantobias
23rd April 2011, 13:07
I do not know what the problem, but without designer-ui is good... :(
Never mind...

Zlatomir
23rd April 2011, 14:24
The ui pointer get initialized?
You created the design and later added to an existent project?

You need to tell us more about what have you done, else we can't help you.

Anyway, the segmentation fault error means some memory corruption because some misuse of pointers, so check the pointers to be initialized before you use them, check that list (so that i to be a valid index) and use the debugger to see exactly where your application is failing.