QT 5.15 Windows Crash on deallocation of QModelIndexList
-
I'm with the Freespace 2 SCP and we are getting a crash on deallocation of QModelndexList on debug. I know this is similar to several previous reports. I am on windows 11 and installed Qt Using the online installer. We are almost certainly linking to the correct libraries as the images below show.
Can anybody help?The error message we are getting is this.
The relevant section of code.auto list = ui->shipCombo->model()->match(ui->shipCombo->model()->index(0, 0), Qt::UserRole, ship_class); if (!list.empty() || ui->classList->model()->rowCount() == 0) { ui->shipCombo->setCurrentIndex(list.first().row()); } else { //Show error message } list = ui->variableCombo->model()->match(ui->variableCombo->model()->index(0, 0), Qt::UserRole, variable); if (!list.empty() || ui->classList->model()->rowCount() == 0) { ui->variableCombo->setCurrentIndex(list.first().row()); } else { //Show error message }
Here is the proof that we are linking to the right libraries given that that seems to be the most common solution provided.
-
I'm with the Freespace 2 SCP and we are getting a crash on deallocation of QModelndexList on debug. I know this is similar to several previous reports. I am on windows 11 and installed Qt Using the online installer. We are almost certainly linking to the correct libraries as the images below show.
Can anybody help?The error message we are getting is this.
The relevant section of code.auto list = ui->shipCombo->model()->match(ui->shipCombo->model()->index(0, 0), Qt::UserRole, ship_class); if (!list.empty() || ui->classList->model()->rowCount() == 0) { ui->shipCombo->setCurrentIndex(list.first().row()); } else { //Show error message } list = ui->variableCombo->model()->match(ui->variableCombo->model()->index(0, 0), Qt::UserRole, variable); if (!list.empty() || ui->classList->model()->rowCount() == 0) { ui->variableCombo->setCurrentIndex(list.first().row()); } else { //Show error message }
Here is the proof that we are linking to the right libraries given that that seems to be the most common solution provided.
@The-Force said in QT 5.15 Windows Crash on deallocation of QModelIndexList:
__acrt_first_block == header
...usually points at out-of-bounds access.
if (!list.empty() || ui->classList->model()->rowCount() == 0) ui->shipCombo->setCurrentIndex(list.first().row());
If
list
is empty and the model's row count is zero,list.first()
causes a read out of bounds and is probably the reason for the crash.Something like
if (!list.empty() && ui->classList->model()->rowCount() != 0) ui->shipCombo->setCurrentIndex(list.first().row());
...would make more sense to me.
-
I'm with the Freespace 2 SCP and we are getting a crash on deallocation of QModelndexList on debug. I know this is similar to several previous reports. I am on windows 11 and installed Qt Using the online installer. We are almost certainly linking to the correct libraries as the images below show.
Can anybody help?The error message we are getting is this.
The relevant section of code.auto list = ui->shipCombo->model()->match(ui->shipCombo->model()->index(0, 0), Qt::UserRole, ship_class); if (!list.empty() || ui->classList->model()->rowCount() == 0) { ui->shipCombo->setCurrentIndex(list.first().row()); } else { //Show error message } list = ui->variableCombo->model()->match(ui->variableCombo->model()->index(0, 0), Qt::UserRole, variable); if (!list.empty() || ui->classList->model()->rowCount() == 0) { ui->variableCombo->setCurrentIndex(list.first().row()); } else { //Show error message }
Here is the proof that we are linking to the right libraries given that that seems to be the most common solution provided.
@The-Force said in QT 5.15 Windows Crash on deallocation of QModelIndexList:
I know this is similar to several previous reports.
Which reports? Can we have some links?
-
Actually I've just found our solution here
https://forum.qt.io/topic/157255/getting-debug-heap-correction-from-destructor-of-qstringlist/19
I seems that our camke config has not been linking msvcrtd.lib
-
I'm with the Freespace 2 SCP and we are getting a crash on deallocation of QModelndexList on debug. I know this is similar to several previous reports. I am on windows 11 and installed Qt Using the online installer. We are almost certainly linking to the correct libraries as the images below show.
Can anybody help?The error message we are getting is this.
The relevant section of code.auto list = ui->shipCombo->model()->match(ui->shipCombo->model()->index(0, 0), Qt::UserRole, ship_class); if (!list.empty() || ui->classList->model()->rowCount() == 0) { ui->shipCombo->setCurrentIndex(list.first().row()); } else { //Show error message } list = ui->variableCombo->model()->match(ui->variableCombo->model()->index(0, 0), Qt::UserRole, variable); if (!list.empty() || ui->classList->model()->rowCount() == 0) { ui->variableCombo->setCurrentIndex(list.first().row()); } else { //Show error message }
Here is the proof that we are linking to the right libraries given that that seems to be the most common solution provided.
@The-Force said in QT 5.15 Windows Crash on deallocation of QModelIndexList:
__acrt_first_block == header
...usually points at out-of-bounds access.
if (!list.empty() || ui->classList->model()->rowCount() == 0) ui->shipCombo->setCurrentIndex(list.first().row());
If
list
is empty and the model's row count is zero,list.first()
causes a read out of bounds and is probably the reason for the crash.Something like
if (!list.empty() && ui->classList->model()->rowCount() != 0) ui->shipCombo->setCurrentIndex(list.first().row());
...would make more sense to me.
-