Skip to content

Commit

Permalink
Refs #4174: Martyn is correct, the delete alg is responsible.
Browse files Browse the repository at this point in the history
Adding big uppercase warning to future developers NOT to delete the pointer.
  • Loading branch information
Janik Zikovsky committed Nov 21, 2011
1 parent afbfdaf commit cb2f4ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
8 changes: 7 additions & 1 deletion Code/Mantid/Framework/API/src/FrameworkManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ void FrameworkManagerImpl::clearInstruments()
*
* @param algName :: The name of the algorithm required
* @param version :: The version of the algorithm
* @return A pointer to the created algorithm
* @return A pointer to the created algorithm.
* WARNING! DO NOT DELETE THIS POINTER, because it is owned
* by a shared pointer in the AlgorithmManager.
*
* @throw NotFoundError Thrown if algorithm requested is not registered
*/
Expand All @@ -123,6 +125,8 @@ IAlgorithm* FrameworkManagerImpl::createAlgorithm(const std::string& algName, co
* form "Property1=Value1;Property2=Value2;..."
* @param version :: The version of the algorithm
* @return A pointer to the created algorithm
* WARNING! DO NOT DELETE THIS POINTER, because it is owned
* by a shared pointer in the AlgorithmManager.
*
* @throw NotFoundError Thrown if algorithm requested is not registered
* @throw std::invalid_argument Thrown if properties string is ill-formed
Expand All @@ -143,6 +147,8 @@ IAlgorithm* FrameworkManagerImpl::createAlgorithm(const std::string& algName,con
* form "Property1=Value1;Property2=Value2;..."
* @param version :: The version of the algorithm
* @return A pointer to the executed algorithm
* WARNING! DO NOT DELETE THIS POINTER, because it is owned
* by a shared pointer in the AlgorithmManager.
*
* @throw NotFoundError Thrown if algorithm requested is not registered
* @throw std::invalid_argument Thrown if properties string is ill-formed
Expand Down
20 changes: 0 additions & 20 deletions Code/Mantid/Framework/API/test/FrameworkManagerTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,26 +78,6 @@ class FrameworkManagerTest : public CxxTest::TestSuite
{
TS_ASSERT_THROWS( FrameworkManager::Instance().getWorkspace("wrongname"), std::runtime_error )
}
//
// /** Ticket #4174: this algorithm segfaults at the point where you've
// * created 50 (the algorithms.retained property) in a row.
// */
// void test_CreateAlgorithm_manytimes()
// {
// for (size_t i=0; i<100; i++)
// {
// std::cout << "Creating algorithm #" << i << std::endl;
// IAlgorithm * alg = FrameworkManager::Instance().createAlgorithm("CreateWorkspace");
// // The line below segfaults at i = 50 (the algorithms.retained property)
// alg->setPropertyValue("OutputWorkspace", "dummy");
// alg->setPropertyValue("DataX", "1");
// alg->setPropertyValue("DataY", "2");
// alg->execute();
// delete alg;
// // You can add this sleep line and it still segfaults.
// //sleep(1);
// }
// }

};

Expand Down

0 comments on commit cb2f4ac

Please sign in to comment.