Skip to content

Commit

Permalink
Refs #11597 allow temp ws to be deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonPiccardoSelg committed Apr 21, 2015
1 parent c535e18 commit 677dfcc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ void MdViewerWidget::renderOriginalWorkspace(const std::string originalWorkspace
{
// Load a new source plugin
QString sourcePlugin = "MDEW Source";
this->currentView->setPluginSource(sourcePlugin, QString::fromStdString(originalWorkspaceName));
pqPipelineSource* src = this->currentView->setPluginSource(sourcePlugin, QString::fromStdString(originalWorkspaceName));

// Render and final setup
this->renderAndFinalSetup();
Expand Down Expand Up @@ -1308,15 +1308,6 @@ void MdViewerWidget::preDeleteHandle(const std::string &wsName,
}
}


// Check if rebinned source and perform an unbinning
if (m_rebinnedSourcesManager.isRebinnedSource(wsName))
{
removeRebinning(src, true);
return;
}


// Remove all visibility listeners
this->currentView->removeVisibilityListener();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,20 @@ namespace Mantid
{
// If the original workspace has been deleted, then delete the rebinned
// source (and workspace via the listener)
if (m_originalWorkspaceToRebinnedWorkspace.count(wsName))
bool isOriginal = m_originalWorkspaceToRebinnedWorkspace.count(wsName) > 0;
bool isRebinned = m_rebinnedWorkspaceToOriginalWorkspace.count(wsName) > 0;
if (isOriginal || isRebinned)
{
// Get the rebinned source and destroy the entire pipeline
pqPipelineSource* source = getSourceForWorkspace(m_originalWorkspaceToRebinnedWorkspace[wsName]);
pqPipelineSource* source;
if (isOriginal)
{
source = getSourceForWorkspace(m_originalWorkspaceToRebinnedWorkspace[wsName]);
}
else
{
source = getSourceForWorkspace(wsName);
}

// Go to the end of the pipeline
while(source->getNumberOfConsumers() > 0)
Expand All @@ -123,7 +133,15 @@ namespace Mantid
}

builder->destroy(source); // The listener takes now care of the workspace.
untrackWorkspaces(m_originalWorkspaceToRebinnedWorkspace[wsName]);

if (isOriginal)
{
untrackWorkspaces(m_originalWorkspaceToRebinnedWorkspace[wsName]);
}
else
{
untrackWorkspaces(m_rebinnedWorkspaceToOriginalWorkspace[wsName]);
}
}
}

Expand Down

0 comments on commit 677dfcc

Please sign in to comment.