[Orxonox-commit 5281] r9944 - in code/trunk/src: libraries/core/object orxonox/gamestates
landauf at orxonox.net
landauf at orxonox.net
Fri Jan 3 13:29:33 CET 2014
Author: landauf
Date: 2014-01-03 13:29:33 +0100 (Fri, 03 Jan 2014)
New Revision: 9944
Modified:
code/trunk/src/libraries/core/object/Destroyable.cc
code/trunk/src/libraries/core/object/Destroyable.h
code/trunk/src/orxonox/gamestates/GSMainMenu.cc
Log:
no Thilo, we don't want to call preDestroy()
made documentation of destroy() and preDestroy() more explicit.
Modified: code/trunk/src/libraries/core/object/Destroyable.cc
===================================================================
--- code/trunk/src/libraries/core/object/Destroyable.cc 2014-01-03 11:45:21 UTC (rev 9943)
+++ code/trunk/src/libraries/core/object/Destroyable.cc 2014-01-03 12:29:33 UTC (rev 9944)
@@ -60,6 +60,7 @@
/**
@brief Deletes the object if no @ref orxonox::SmartPtr "smart pointers" point to this object. Otherwise schedules the object to be deleted as soon as possible.
+ Always call destroy() instead of using 'delete' directly, otherwise smart pointers won't work.
*/
void Destroyable::destroy()
{
Modified: code/trunk/src/libraries/core/object/Destroyable.h
===================================================================
--- code/trunk/src/libraries/core/object/Destroyable.h 2014-01-03 11:45:21 UTC (rev 9943)
+++ code/trunk/src/libraries/core/object/Destroyable.h 2014-01-03 12:29:33 UTC (rev 9944)
@@ -62,7 +62,8 @@
{ return this->referenceCount_; }
protected:
- /// This virtual function is called if destroy() is called and no SmartPtr points to this object. Used in some cases to create a new SmartPtr to prevent destruction.
+ /// This virtual function is called if destroy() is called and no SmartPtr points to this object. Used in some cases to create a new SmartPtr to
+ /// prevent destruction. Don't call this function directly - use destroy() instead.
virtual void preDestroy() {}
private:
Modified: code/trunk/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSMainMenu.cc 2014-01-03 11:45:21 UTC (rev 9943)
+++ code/trunk/src/orxonox/gamestates/GSMainMenu.cc 2014-01-03 12:29:33 UTC (rev 9944)
@@ -84,7 +84,7 @@
GSMainMenu::~GSMainMenu()
{
if (GameMode::playsSound())
- this->ambient_->destroy(); //CHECK Thilo destroy ?preDestroy()? !!!!!!!
+ this->ambient_->destroy();
InputManager::getInstance().destroyState("MainMenuHackery");
More information about the Orxonox-commit
mailing list