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:
@@ -1,30 +1,17 @@
|
||||
#include <osg/DisplaySettings>
|
||||
#include <osg/ref_ptr>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace osg;
|
||||
using namespace std;
|
||||
|
||||
class DisplaySettingsPtr
|
||||
{
|
||||
public:
|
||||
DisplaySettingsPtr() : _ptr(0L) {}
|
||||
DisplaySettingsPtr(DisplaySettings* t): _ptr(t) {}
|
||||
DisplaySettingsPtr(const DisplaySettingsPtr& rp):_ptr(rp._ptr) { }
|
||||
~DisplaySettingsPtr() { if (_ptr) delete _ptr; _ptr=0L; }
|
||||
|
||||
inline DisplaySettings* get() { return _ptr; }
|
||||
|
||||
DisplaySettings* _ptr;
|
||||
};
|
||||
|
||||
DisplaySettings* DisplaySettings::instance()
|
||||
{
|
||||
static DisplaySettingsPtr s_displaySettings = new DisplaySettings;
|
||||
static ref_ptr<DisplaySettings> s_displaySettings = new DisplaySettings;
|
||||
return s_displaySettings.get();
|
||||
}
|
||||
|
||||
|
||||
DisplaySettings::DisplaySettings(const DisplaySettings& vs):Referenced()
|
||||
{
|
||||
copy(vs);
|
||||
|
||||
Reference in New Issue
Block a user