The following code is giving me an issue.

Qt Code:
  1. void MainWindow::onDelete()
  2. {
  3.  
  4. if(ui->tableWidget->selectionModel()->hasSelection()){
  5.  
  6. QItemSelectionModel *selectionmodel =ui->tableWidget->selectionModel();
  7. QModelIndexList selected_items= selectionmodel->selectedRows();
  8. qSort(selected_items);
  9. }
To copy to clipboard, switch view to plain text mode 

Whenever I run it, the program crashes giving me an error:
Invalid address specified to RtlValidateHeap( 006A0000, 00F4DB90 )

It appears to be trying to delete a node from the code in qlist. I am unable to figure out the error. Any advice would be great.