Re: Crash-Segmentation fault
A segmentation fault is typically caused when you try to access memory that hasn't been allocated. A classic example is walking off the end of an array.
It's impossible to say what the problem is in this case; there's not enough code to make a determination. But I'd first look at whether your combo box is initialized properly, since attempting to access it's elements is what causes the problem.
The best thing to do would be to run the program in a debugger, which will let you quickly determine the cause of the problem.
Re: Crash-Segmentation fault
I used Designer to place the combobox. I checked the ui_h file and the combobox pointer is listed with the proper name cmbName. I have tried clean and rebuild. The combo box does get populated with this code:
Code:
void SectionTimer::updateNameComboBox()
{
query.exec("SELECT id,LName, FName FROM master");
ui->cmbName->blockSignals(true);
ui->cmbName->clear();
while (query.next())
{
ui->cmbName->addItem(query.value (2).toString()+ " "
+ query.value (1).toString(),query.value (0).toInt());
ui->cmbName->blockSignals(false);
}
}
And if I comment out the code listed that causes the segmentation fault, the program runs and the combobox is populated. I did run the debugger and posted the picture of the output. I tried to figure out how to get the back trace...is that what is shown in the lower left window?
What else do I need to look at?
Re: Crash-Segmentation fault
I can't read your screenshot very well. It looks like 'id' is 12 and 'index' is...some really large number. Are those the values you're expecting?
Re: Crash-Segmentation fault
No. I mentioned this in my first post as I thought this might be a problem. There are only around 10 entries in the combobox so the number is way off. Also the "this" pointer where the problem resides has a value of "unavailable sychroneous data". This doesn't look right to me either...but I am a newbie and I don't know what it should look like!
Thanks for your assistance!