Remove color bar from SoFCColorBarNotifier to decrease reference counter

This commit is contained in:
wmayer
2024-07-10 22:41:41 +02:00
committed by Yorik van Havre
parent d4cd9a396a
commit cf46809efd
6 changed files with 32 additions and 18 deletions

View File

@@ -115,9 +115,7 @@ ViewProviderInspection::~ViewProviderInspection()
pcCoords->unref();
pcMatBinding->unref();
pcColorMat->unref();
Gui::SoFCColorBarNotifier::instance().detach(pcColorBar);
pcColorBar->Detach(this);
pcColorBar->unref();
deleteColorBar();
pcLinkRoot->unref();
pcPointStyle->unref();
}
@@ -150,6 +148,13 @@ void ViewProviderInspection::show()
pcColorStyle->style = SoDrawStyle::FILLED;
}
void ViewProviderInspection::deleteColorBar()
{
Gui::SoFCColorBarNotifier::instance().detach(pcColorBar);
pcColorBar->Detach(this);
pcColorBar->unref();
}
void ViewProviderInspection::attach(App::DocumentObject* pcFeat)
{
// creates the standard viewing modes
@@ -185,8 +190,7 @@ void ViewProviderInspection::attach(App::DocumentObject* pcFeat)
pcBar->ref();
pcBar->setRange(fMin, fMax, 3);
pcBar->Notify(0);
pcColorBar->Detach(this);
pcColorBar->unref();
deleteColorBar();
pcColorBar = pcBar;
}

View File

@@ -94,8 +94,9 @@ private:
void setupNormals(const std::vector<Base::Vector3f>&);
void setupLineIndexes(const std::vector<Data::ComplexGeoData::Line>&);
void setupFaceIndexes(const std::vector<Data::ComplexGeoData::Facet>&);
void deleteColorBar();
protected:
private:
SoMaterial* pcColorMat;
SoMaterialBinding* pcMatBinding;
SoGroup* pcLinkRoot;