Skip to content

Commit

Permalink
Fixed ecalsys crash #168
Browse files Browse the repository at this point in the history
* Fixed ecalsys crash #168

* Replaced more delete with deleteLater, just in case
  • Loading branch information
FlorianReimold committed Jan 29, 2021
1 parent 8463e4b commit 7a873ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions app/sys/sys_gui/src/widgets/mmawidget/mma_host_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ void MmaHostItem::addWidgetsToTree()
disk_group_widget_ ->setMinimumWidth(2, io_width);

// The widgets might both be deleted when removing this object or when destroying the treeWidget, so we connect the appropriate signals
connect(this, &QObject::destroyed, cpu_bar_, &QObject::deleteLater);
connect(this, &QObject::destroyed, ram_bar_, &QObject::deleteLater);
connect(this, &QObject::destroyed, cpu_bar_, &QObject::deleteLater);
connect(this, &QObject::destroyed, ram_bar_, &QObject::deleteLater);
connect(this, &QObject::destroyed, network_group_widget_, &QObject::deleteLater);
connect(this, &QObject::destroyed, disk_group_widget_, &QObject::deleteLater);

Expand Down Expand Up @@ -161,7 +161,7 @@ void MmaHostItem::setEnabled(bool enabled)
treeWidget()->removeItemWidget(it->second.first->child(0), 0);
network_group_item_->removeChild(it->second.first);
delete it->second.first;
delete it->second.second;
it->second.second->deleteLater();
it = network_items.erase(it);
}
for (auto it = disk_items_.begin(); it != disk_items_.end();)
Expand All @@ -170,8 +170,8 @@ void MmaHostItem::setEnabled(bool enabled)
treeWidget()->removeItemWidget(std::get<0>(it->second)->child(0), 0);
disks_group_item_->removeChild(std::get<0>(it->second));
delete std::get<0>(it->second);
delete std::get<1>(it->second);
delete std::get<2>(it->second);
std::get<1>(it->second)->deleteLater();
std::get<2>(it->second)->deleteLater();
it = disk_items_.erase(it);
}

Expand Down Expand Up @@ -367,8 +367,8 @@ void MmaHostItem::machineStateChanged(eCAL::pb::mma::State state)
treeWidget()->removeItemWidget(std::get<0>(it->second)->child(0), 0);
disks_group_item_->removeChild(std::get<0>(it->second));
delete std::get<0>(it->second);
delete std::get<1>(it->second);
delete std::get<2>(it->second);
std::get<1>(it->second)->deleteLater();
std::get<2>(it->second)->deleteLater();
it = disk_items_.erase(it);
}
}
Expand Down Expand Up @@ -460,7 +460,7 @@ void MmaHostItem::machineStateChanged(eCAL::pb::mma::State state)
treeWidget()->removeItemWidget(it->second.first->child(0), 0);
network_group_item_->removeChild(it->second.first);
delete it->second.first;
delete it->second.second;
it->second.second->deleteLater();
it = network_items.erase(it);
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/sys/sys_gui/src/widgets/mmawidget/mma_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void MmaWidget::monitorUpdated()
if (all_hosts.find(it->first) == all_hosts.end())
{
// The host is not present any more
delete it->second;
it->second->deleteLater();
it = host_items_.erase(it);
}
else
Expand All @@ -82,4 +82,4 @@ void MmaWidget::monitorUpdated()
it++;
}
}
}
}

0 comments on commit 7a873ac

Please sign in to comment.