Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 3, 2015, 2:39:30 PM (9 years ago)
Author:
landauf
Message:

added destroyLater() to Destroyable. This will destroy the object (like destroy()) but not until the current tick has ended.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/core/object/Destroyable.cc

    r9944 r10419  
    3333
    3434#include "Destroyable.h"
     35#include "DestroyLaterManager.h"
    3536
    3637#include <cassert>
     
    7475        }
    7576    }
     77
     78    /**
     79     * Works like @ref destroy() but doesn't destroy the object until the current tick has ended.
     80     */
     81    void Destroyable::destroyLater()
     82    {
     83        // register in DestroyLaterManager - this ensures that a smartPtr points to this object and keeps it alive for a while
     84        DestroyLaterManager::getInstance().retain(this);
     85
     86        // request destruction -> object will be deleted after all smartPtrs (including the one in DestroyLaterManager) were destroyed.
     87        this->destroy();
     88    }
    7689}
Note: See TracChangeset for help on using the changeset viewer.