Commit b9504539 authored by roangel's avatar roangel
Browse files

fixed weird crash when removing all CFZones

parent 26118972
......@@ -46,6 +46,8 @@ public:
void addCFZone(QRectF rect, int index);
void removeAllCFZones();
public slots:
void removeCrazyFlyZone(int cf_zone_index);
void setSelectedCrazyFlyZone(int index);
......
......@@ -821,11 +821,7 @@ void MainGUIWindow::on_load_from_DB_button_clicked()
cf_linker->clear_all_links();
// remove all cf_zones existing
for(int j = scene->crazyfly_zones.size() - 1; j >= 0; j--)
{
scene->removeCrazyFlyZone(scene->crazyfly_zones[j]->getIndex());
}
scene->removeAllCFZones();
int size = scene->crazyfly_zones.size();
ROS_INFO("vector_cf_zones_size %d", size);
......
......@@ -349,6 +349,16 @@ void myGraphicsScene::removeCrazyFlyZone(int cf_zone_index)
}
}
void myGraphicsScene::removeAllCFZones()
{
for(int i = 0; i < crazyfly_zones.size(); i++)
{
this->removeItem(crazyfly_zones[i]);
}
crazyfly_zones.clear();
emit numCrazyFlyZonesChanged(0);
}
void myGraphicsScene::removeTable()
{
for(int i = 0; i < table_pieces.size(); i++)
......
1,CF1,,0,-0.58,1.22,0,0.97,1.89,0
2,CF2,,1,-0.19,0.15,0,0.85,0.96,0
1,CF1,,0,2.30378,0.506831,0,4.29424,2.29456,0
2,CF2,,1,1.59421,0.884651,0,2.66317,1.62186,0
3,CF3,,2,1.51128,1.97203,0,3.11471,2.82904,0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment