Small detail in constructors
parent
8bdef8a392
commit
7832b586e6
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue