qstringlist index out of range at declaration!
I don't know if this is possible...but I get run time error when the program reaches this line:
ASSERT failure in QList<T>::at: "index out of range", file c:\Qt\4.7.4\include/QtCore/../../src/corelib/tools/qlist.h, line 456
How can I be out of range when creating the variables? :confused:
Re: qstringlist index out of range at declaration!
You probably have another bug that has corrupted the stack so that by the time you reach that statement, your program has already run off the rails. Look at what is going on before you get to the crash.
Re: qstringlist index out of range at declaration!
i use the debug mode step by step. When this line is executed I get that error.
In mainwindow.cpp I have a button which calls a slot function
Code:
connect( loadComponentParameters, SIGNAL(triggered()),this->widget,SLOT(loadComponentParameterTableFromFile()) );
when the program gets into the slot function, it works fine, until I get to that declaration.
Moving the declaration in several positions in the function has the same effect. Runtime error when I get there.
Code:
void MyWidget::loadComponentParameterTableFromFile()
{
toggleAutomaticReplotStatus(false);
modelVector->clear();
int lineIndex = 0,model_index = 0, row_index = 0,column_index = 0, numberOfSets = 0;
The program crashes when I just click the loadComponentParameters button!
Any ideas?!
Re: qstringlist index out of range at declaration!
Has "widget" been instantiated at the point where this slot is connected (not invoked)? If you are passing a bogus pointer into the connect call, the slot is getting called on a bogus instance. What is the value of "this" when you step inside the slot? Does it look reasonable, and does it match the value of "widget" created by MainWindow?
Re: qstringlist index out of range at declaration!
Does this line
Code:
modelVector->clear();
by any chance clear a QList that is used as the internal data structure of a QAbstractItemModel? If so, have a look at QAbstractItemModel::beginResetModel() and QAbstractItemModel::endResetModel().