Hello,

I've problems with my application, see, I've a MainWindow which contains a QListWidget and a variable QList<MyStruct> as public. There's a PushButton which opens a new Window, which I can add items to my QList and show them into my QListWidget, but the problem is that I've another PushButton, to edit an existing item, I seem to be allowed to parse the item (struct) successfully to the second Window, but trying to save that item back (replace) crashes my app with a debugger error that says "The inferior stopped because it received a signal from the Operating System".

This is the code I'm using;


Qt Code:
  1. //Edit Conversation
  2. void MainWindow::on_pushButton_4_clicked()
  3. {
  4.  
  5. QModelIndexList indexes = ui->listTalk->selectionModel()->selectedIndexes();
  6. ConversationWindow *dlg = new ConversationWindow(this);
  7. dlg->isEdit = true;
  8.  
  9. dlg->editConversation((quint8)indexes.at(0).row(), TalkList.at(indexes.at(0).row()));
  10.  
  11. if (indexes.count() > 0)
  12. dlg->show();
  13. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. // Add or Edit existing conversation
  2. void ConversationWindow::on_pushButton_2_clicked()
  3. {
  4. ConversationItem item;
  5.  
  6. if (!isEdit)
  7. {
  8. item.Key1_t = ui->lineEdit->text();
  9. item.Key2_t = ui->lineEdit_2->text();
  10. item.Key3_t = ui->lineEdit_3->text();
  11. item.getState = ui->checkBox->checkState();
  12. item.setState = ui->checkBox_2->checkState();
  13. item.getStateValue = ui->spinBox->value();
  14. item.setStateValue = ui->spinBox_2->value();
  15. item.JustAnswer = ui->checkBox_3->checkState();
  16. item.Answer_t = ui->lineEdit_4->text();
  17. item.isScript = ui->checkBox_5->checkState();
  18. item.Script_t << ui->textEdit->toPlainText();
  19.  
  20. list->append(item);
  21.  
  22. close();
  23.  
  24. window->DrawTalk();
  25. } else {
  26. item.Key1_t = ui->lineEdit->text();
  27. item.Key2_t = ui->lineEdit_2->text();
  28. item.Key3_t = ui->lineEdit_3->text();
  29. item.getState = ui->checkBox->checkState();
  30. item.setState = ui->checkBox_2->checkState();
  31. item.getStateValue = ui->spinBox->value();
  32. item.setStateValue = ui->spinBox_2->value();
  33. item.JustAnswer = ui->checkBox_3->checkState();
  34. item.Answer_t = ui->lineEdit_4->text();
  35. item.isScript = ui->checkBox_5->checkState();
  36. item.Script_t << ui->textEdit->toPlainText();
  37.  
  38. // I've tried with replace but same error appears.
  39. list->removeAt(editIndex);
  40. list->insert(editIndex, item);
  41.  
  42. isEdit = false;
  43. }
  44. }
To copy to clipboard, switch view to plain text mode 

I'm parsing the item index correctly checked with debug.
Please help me )