Small detail in constructors

release/4.3a0
Frank Dellaert 2012-06-15 01:00:50 +00:00
parent 8bdef8a392
commit 7832b586e6
1 changed files with 4 additions and 3 deletions

View File

@ -321,20 +321,21 @@ public:
// Constructor for free-store allocated objects. // Constructor for free-store allocated objects.
// Creates shared pointer, will delete if is last one to hold pointer // Creates shared pointer, will delete if is last one to hold pointer
ObjectHandle(T* ptr) : ObjectHandle(T* ptr) :
type(&typeid(T)), t(boost::shared_ptr<T> (ptr)) { type(&typeid(T)), t(ptr) {
signature = this; signature = this;
} }
// Constructor for shared pointers // Constructor for shared pointers
// Creates shared pointer, will delete if is last one to hold pointer // Creates shared pointer, will delete if is last one to hold pointer
ObjectHandle(boost::shared_ptr<T> ptr) : ObjectHandle(boost::shared_ptr<T> shared_ptr) :
/*type(&typeid(T)),*/ t(ptr) { /*type(&typeid(T)),*/ t(shared_ptr) {
signature = this; signature = this;
} }
~ObjectHandle() { ~ObjectHandle() {
// object is in shared_ptr, will be automatically deleted // object is in shared_ptr, will be automatically deleted
signature = 0; // destroy signature signature = 0; // destroy signature
// std::cout << "ObjectHandle destructor" << std::endl;
} }
// Get the actual object contained by handle // Get the actual object contained by handle