Made the more of the OSG's referenced object desctructors protected to ensure
that they arn't created on the stack inappropriately. Split the implemention of Matrix up so that it is a simple no referenced counted class and can be safefly created on the stack. To support referenced counting a seperate subclass now exists, this is RefMatrix which inherits from both Matrix and Object.
This commit is contained in:
@@ -28,22 +28,9 @@ void PrintFilePathList(std::ostream& stream,const FilePathList& filepath)
|
||||
}
|
||||
}
|
||||
|
||||
class RegistryPtr
|
||||
{
|
||||
public:
|
||||
RegistryPtr() : _ptr(0L) {}
|
||||
RegistryPtr(Registry* t): _ptr(t) {}
|
||||
RegistryPtr(const RegistryPtr& rp):_ptr(rp._ptr) { }
|
||||
~RegistryPtr() { if (_ptr) delete _ptr; _ptr=0L; }
|
||||
|
||||
inline Registry* get() { return _ptr; }
|
||||
|
||||
Registry* _ptr;
|
||||
};
|
||||
|
||||
Registry* Registry::instance()
|
||||
{
|
||||
static RegistryPtr s_nodeFactory = new Registry;
|
||||
static ref_ptr<Registry> s_nodeFactory = new Registry;
|
||||
return s_nodeFactory.get();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user