1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Corrected order of deletion of feature vs feature GUI. Fixes #1332

This commit is contained in:
f4exb 2022-07-22 03:25:14 +02:00
parent da14591c93
commit de6bd1f608
2 changed files with 17 additions and 4 deletions

View File

@ -66,8 +66,8 @@ void FeatureUISet::freeFeatures()
qDebug("FeatureUISet::freeFeatures: destroying feature [%s]",
qPrintable(m_featureInstanceRegistrations.at(i).m_feature->getURI())
);
m_featureInstanceRegistrations.at(i).m_feature->destroy();
m_featureInstanceRegistrations.at(i).m_gui->destroy();
m_featureInstanceRegistrations.at(i).m_feature->destroy();
}
m_featureInstanceRegistrations.clear();
@ -82,8 +82,8 @@ void FeatureUISet::deleteFeature(int featureIndex)
qPrintable(m_featureInstanceRegistrations.at(featureIndex).m_feature->getURI()),
featureIndex
);
m_featureInstanceRegistrations.at(featureIndex).m_feature->destroy();
m_featureInstanceRegistrations.at(featureIndex).m_gui->destroy();
m_featureInstanceRegistrations.at(featureIndex).m_feature->destroy();
m_featureInstanceRegistrations.removeAt(featureIndex);
m_featureSet->removeFeatureInstanceAt(featureIndex);
}
@ -233,8 +233,14 @@ void FeatureUISet::handleClosingFeatureGUI(FeatureGUI *featureGUI)
{
if (it->m_gui == featureGUI)
{
m_featureSet->removeFeatureInstance(it->m_feature);
it->m_feature->destroy();
Feature *feature = it->m_feature;
m_featureSet->removeFeatureInstance(feature);
QObject::connect(
featureGUI,
&FeatureGUI::destroyed,
this,
[this, feature](){ this->handleDeleteFeature(feature); }
);
m_featureInstanceRegistrations.erase(it);
break;
}
@ -245,3 +251,8 @@ void FeatureUISet::handleClosingFeatureGUI(FeatureGUI *featureGUI)
m_featureInstanceRegistrations.at(i).m_gui->setIndex(i);
}
}
void FeatureUISet::handleDeleteFeature(Feature *feature)
{
feature->destroy();
}

View File

@ -85,6 +85,8 @@ private:
private slots:
void handleClosingFeatureGUI(FeatureGUI *featureGUI);
void handleDeleteFeature(Feature *feature);
};
#endif // SDRGUI_FEATURE_FEATUREUISET_H_