diff --git a/src/osgPlugins/bsp/VBSPData.h b/src/osgPlugins/bsp/VBSPData.h index f1617efdb..51e932acf 100644 --- a/src/osgPlugins/bsp/VBSPData.h +++ b/src/osgPlugins/bsp/VBSPData.h @@ -162,7 +162,7 @@ struct DisplacedVertex }; -class VBSPData +class VBSPData : public osg::Referenced { protected: @@ -211,10 +211,11 @@ protected: typedef std::vector< osg::ref_ptr > StateSetList; StateSetList state_set_list; + virtual ~VBSPData(); + public: VBSPData(); - virtual ~VBSPData(); void addEntity(std::string & newEntity); const int getNumEntities() const; diff --git a/src/osgPlugins/bsp/VBSPReader.cpp b/src/osgPlugins/bsp/VBSPReader.cpp index 420a4ed89..549a14c9a 100644 --- a/src/osgPlugins/bsp/VBSPReader.cpp +++ b/src/osgPlugins/bsp/VBSPReader.cpp @@ -1055,7 +1055,7 @@ void VBSPReader::createScene() { // Get the entity entityText = bsp_data->getEntity(i); - currentEntity = new VBSPEntity(entityText, bsp_data); + currentEntity = new VBSPEntity(entityText, bsp_data.get()); // See if the entity is visible if (currentEntity->isVisible()) diff --git a/src/osgPlugins/bsp/VBSPReader.h b/src/osgPlugins/bsp/VBSPReader.h index 16469de7e..8e1c8d0b9 100644 --- a/src/osgPlugins/bsp/VBSPReader.h +++ b/src/osgPlugins/bsp/VBSPReader.h @@ -233,7 +233,7 @@ protected: std::string map_name; - VBSPData * bsp_data; + osg::ref_ptr bsp_data; osg::ref_ptr root_node;