Skip to content

Commit

Permalink
attemp at fixing crash on delete from tablewidget
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenemel committed Jan 31, 2018
1 parent 56cad91 commit 43b8d41
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/maven/tabledockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ void TableDockWidget::addRow(PeakGroup* group, QTreeWidgetItem* root) {
if (group == NULL) return;
if (group->peakCount() == 0 ) return;
if (group->meanMz <= 0 ) return;
if (group->label == 'x') return; //deleted group
if (group->deletedFlag || group->label == 'x') return; //deleted group

NumericTreeWidgetItem *item=NULL;
if(!root) {
Expand Down Expand Up @@ -634,7 +634,12 @@ void TableDockWidget::deleteSelected() {
group->setLabel('x');
deleteCount++;
}

//which items will displayed next
nextItem = treeWidget->itemBelow(item); //get next item
if(!nextItem) nextItem = treeWidget->itemAbove(item);

//remove item from the tree
if (item->parent()) {
item->parent()->removeChild(item);
} else {
Expand All @@ -643,6 +648,8 @@ void TableDockWidget::deleteSelected() {
}
}

//deleting items from tree causes crash.. not clear yet where bug is
/*
if (deleteCount) {
for(int i=0; i < allgroups.size(); i++) {
if(allgroups[i].deletedFlag) {
Expand All @@ -652,6 +659,7 @@ void TableDockWidget::deleteSelected() {
}
}
}
*/

if (nextItem) {
treeWidget->setCurrentItem(nextItem);
Expand Down
2 changes: 1 addition & 1 deletion src/maven_core
Submodule maven_core updated 1 files
+31 −1 test/mstoolkit.cpp

0 comments on commit 43b8d41

Please sign in to comment.