Hi,

I have a little bit of trouble with my application crashing while filling a combo box.

Qt Code:
  1. gameLabel = new QLabel(tr("Spielname:"));
  2. gameCombo = new QComboBox();
  3.  
  4. connect(gameCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(loadGameInfo(int)));
  5.  
  6.  
  7. games->setTable("games");
  8. games->setSort(1, Qt::AscendingOrder);
  9. games->select();
  10.  
  11. qDebug() << "LoadGameDialog: Row Count";
  12. qDebug() << games->rowCount();
  13.  
  14. for (int i = 0; i < games->rowCount(); ++i) {
  15.  
  16. QSqlRecord r = games->record(i);
  17.  
  18. qDebug() << "LoadGameDialog: name ";
  19. qDebug() << r.value("name").toString();
  20. qDebug() << "LoadGameDialog: id_games";
  21. qDebug() << r.value("id_games");
  22.  
  23. gameCombo->addItem(r.value("name").toString(), r.value("id_games"));
  24.  
  25. qDebug() << "Item added to combo box";
  26.  
  27. }
To copy to clipboard, switch view to plain text mode 

I'm not even sure if the addItem() function is the problem since it worked fine till now. But the commandline output lead me to the conclusion that the crash is caused by the addItem() function.

Here is the Console

Qt Code:
  1. Starte E:\Workspace\MASA\trunk\MASA-build-desktop\debug\MASA.exe...
  2. [Main] Cannot load translation file
  3. [DbConnection] DB Connection "qt_sql_default_connection" established
  4. Enter MainWindow::loadGame
  5. before new dialog
  6. LoadGameDialog: Row Count
  7. 72
  8. LoadGameDialog: name
  9. "20120207-TestKameraeinstellungUSZ"
  10. LoadGameDialog: id_games
  11. QVariant(int, 73)
  12. E:\Workspace\MASA\trunk\MASA-build-desktop\debug\MASA.exe beendet, Rückgabewert -1073741819
To copy to clipboard, switch view to plain text mode