Commit 326183b5 authored by Alvaro Sanchez's avatar Alvaro Sanchez

Temporary fix to avoid segfaults when exiting cmb6.

Things are not getting destroyed in the correct order, vtkSMTKResourceManagerProxy
is gone before other pqProxies.  This fix only allows cmb6 to exit normally so that
panel positions are correctly restored between runs.
parent 29be447a
Pipeline #86768 passed with stage
......@@ -42,7 +42,9 @@ pqSMTKModelRepresentation::~pqSMTKModelRepresentation()
auto rsrcMgrPxy = smtk->resourceManagerForServer(this->getServer());
if (rsrcMgrPxy)
{
rsrcMgrPxy->smtkSelection()->unobserve(m_selnObserver);
auto sel = rsrcMgrPxy->smtkSelection();
if (sel)
sel->unobserve(m_selnObserver);
}
}
}
......
......@@ -49,8 +49,11 @@ pqSMTKResource::~pqSMTKResource()
if (rsrcMgrPxy)
{
auto rsrcMgr = rsrcMgrPxy->smtkResourceManager();
std::cout << " Removing " << lastRsrc << " from mgr " << rsrcMgr << "\n";
rsrcMgr->remove(lastRsrc);
if (rsrcMgr)
{
std::cout << " Removing " << lastRsrc << " from mgr " << rsrcMgr << "\n";
rsrcMgr->remove(lastRsrc);
}
}
}
std::cout << "Killing a resource and frowning at a small kitten\n";
......
......@@ -119,17 +119,17 @@ vtkSMSMTKResourceManagerProxy* pqSMTKResourceManager::smtkProxy() const
smtk::resource::ManagerPtr pqSMTKResourceManager::smtkResourceManager() const
{
return this->smtkProxy()->GetManager();
return this->smtkProxy() ? this->smtkProxy()->GetManager() : nullptr;
}
smtk::operation::ManagerPtr pqSMTKResourceManager::smtkOperationManager() const
{
return this->smtkProxy()->GetOperationManager();
return this->smtkProxy() ? this->smtkProxy()->GetOperationManager() : nullptr;
}
smtk::view::SelectionPtr pqSMTKResourceManager::smtkSelection() const
{
return this->smtkProxy()->GetSelection();
return this->smtkProxy() ? this->smtkProxy()->GetSelection() : nullptr;
}
pqSMTKResource* pqSMTKResourceManager::getPVResource(smtk::resource::ResourcePtr rsrc) const
......
Markdown is supported
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