From 895f31fefca6fda4927a702833fd464b3e98da50 Mon Sep 17 00:00:00 2001
From: Roman Tolchenov <roman.tolchenov@stfc.ac.uk>
Date: Fri, 17 Dec 2010 10:55:37 +0000
Subject: [PATCH] Added missing call to IFunction::setWorkspace in
 FitPropertyBrowser. re #1547

---
 .../qtiplot/src/Mantid/FitPropertyBrowser.cpp     | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/Code/qtiplot/qtiplot/src/Mantid/FitPropertyBrowser.cpp b/Code/qtiplot/qtiplot/src/Mantid/FitPropertyBrowser.cpp
index 5fc9590dc04..b2e83c5e838 100644
--- a/Code/qtiplot/qtiplot/src/Mantid/FitPropertyBrowser.cpp
+++ b/Code/qtiplot/qtiplot/src/Mantid/FitPropertyBrowser.cpp
@@ -2070,11 +2070,11 @@ void FitPropertyBrowser::findPeaks()
   std::string peakListName = wsName + "_PeakList_tmp";
 
   int FWHM,Tolerance;
-  QString setting = QString::fromStdString(Mantid::Kernel::ConfigService::Instance().getString("curvefitting.findPeaksFWHM"));
-  FWHM = setting.isEmpty() ? 7 : setting.toInt();
-
-  setting = QString::fromStdString(Mantid::Kernel::ConfigService::Instance().getString("curvefitting.findPeaksTolerance"));
-  Tolerance = setting.isEmpty() ? 4 : setting.toInt();
+  QString setting = QString::fromStdString(Mantid::Kernel::ConfigService::Instance().getString("curvefitting.findPeaksFWHM"));
+  FWHM = setting.isEmpty() ? 7 : setting.toInt();
+
+  setting = QString::fromStdString(Mantid::Kernel::ConfigService::Instance().getString("curvefitting.findPeaksTolerance"));
+  Tolerance = setting.isEmpty() ? 4 : setting.toInt();
 
   Mantid::API::IAlgorithm_sptr alg = Mantid::API::AlgorithmManager::Instance().create("FindPeaks");
   alg->initialize();
@@ -2086,6 +2086,10 @@ void FitPropertyBrowser::findPeaks()
 
   QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
 
+  Mantid::API::MatrixWorkspace_sptr inputWS =
+      boost::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(
+          Mantid::API::AnalysisDataService::Instance().retrieve(workspaceName()));
+
   try
   {
     alg->execute();
@@ -2104,6 +2108,7 @@ void FitPropertyBrowser::findPeaks()
         );
       if (!f) break;
       f->initialize();
+      f->setWorkspace(inputWS,workspaceIndex(),-1,-1);
       f->setCentre(centre[i]);
       f->setWidth(width[i]);
       f->setHeight(height[i]);
-- 
GitLab