From 0dd625f17ec2ff2855ad11d1c988bc2108b33251 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 23 Jul 2015 15:46:47 +0000 Subject: [PATCH] Added explicit initialization of osg::Referenced(true) to osg::Operation subclasses as it uses virtual inhertiance from osg::Referenced. git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15025 16af8721-9629-0410-8352-f15c8da7e697 --- examples/osganalysis/osganalysis.cpp | 1 + examples/osgcatch/osgcatch.cpp | 1 + examples/osggraphicscost/osggraphicscost.cpp | 1 + examples/osgmotionblur/osgmotionblur.cpp | 1 + examples/osgshaderterrain/osgshaderterrain.cpp | 1 + examples/osgtext/osgtext.cpp | 1 + examples/osgthreadedterrain/osgthreadedterrain.cpp | 2 ++ examples/osgvolume/osgvolume.cpp | 1 + include/osg/GraphicsThread | 3 +++ include/osg/OperationThread | 5 +---- src/osg/GraphicsThread.cpp | 2 ++ src/osg/OperationThread.cpp | 1 + src/osgUtil/GLObjectsVisitor.cpp | 2 ++ src/osgUtil/IncrementalCompileOperation.cpp | 1 + src/osgUtil/RenderStage.cpp | 1 + src/osgViewer/Renderer.cpp | 1 + 16 files changed, 21 insertions(+), 4 deletions(-) diff --git a/examples/osganalysis/osganalysis.cpp b/examples/osganalysis/osganalysis.cpp index d4df072d3..a420c8297 100644 --- a/examples/osganalysis/osganalysis.cpp +++ b/examples/osganalysis/osganalysis.cpp @@ -540,6 +540,7 @@ public: const std::string& outputFilename, SceneGraphProcessor* sceneGraphProcessor, osgUtil::IncrementalCompileOperation* ico): + osg::Referenced(true), Operation("DatabasePaging Operation", false), _filename(filename), _outputFilename(outputFilename), diff --git a/examples/osgcatch/osgcatch.cpp b/examples/osgcatch/osgcatch.cpp index 85fbe81e0..44b34c199 100644 --- a/examples/osgcatch/osgcatch.cpp +++ b/examples/osgcatch/osgcatch.cpp @@ -1366,6 +1366,7 @@ class CompileStateCallback : public osg::Operation { public: CompileStateCallback(GameEventHandler* eh): + osg::Referenced(true), osg::Operation("CompileStateCallback", false), _gameEventHandler(eh) {} diff --git a/examples/osggraphicscost/osggraphicscost.cpp b/examples/osggraphicscost/osggraphicscost.cpp index 2b8b37945..4745de9c2 100644 --- a/examples/osggraphicscost/osggraphicscost.cpp +++ b/examples/osggraphicscost/osggraphicscost.cpp @@ -29,6 +29,7 @@ class CalibrateCostEsimator : public osg::GraphicsOperation public: CalibrateCostEsimator(osg::GraphicsCostEstimator* gce): + osg::Referenced(true), osg::GraphicsOperation("CalbirateCostEstimator",false), _gce(gce) {} diff --git a/examples/osgmotionblur/osgmotionblur.cpp b/examples/osgmotionblur/osgmotionblur.cpp index 4cdaeec7b..d5ace21f6 100644 --- a/examples/osgmotionblur/osgmotionblur.cpp +++ b/examples/osgmotionblur/osgmotionblur.cpp @@ -26,6 +26,7 @@ class MotionBlurOperation: public osg::Operation { public: MotionBlurOperation(double persistence): + osg::Referenced(true), osg::Operation("MotionBlur",true), cleared_(false), persistence_(persistence) diff --git a/examples/osgshaderterrain/osgshaderterrain.cpp b/examples/osgshaderterrain/osgshaderterrain.cpp index 9424ad278..8d23ffac6 100644 --- a/examples/osgshaderterrain/osgshaderterrain.cpp +++ b/examples/osgshaderterrain/osgshaderterrain.cpp @@ -261,6 +261,7 @@ class TestSupportOperation: public osg::GraphicsOperation public: TestSupportOperation(): + osg::Referenced(true), osg::GraphicsOperation("TestSupportOperation",false), _supported(true), _errorMessage() {} diff --git a/examples/osgtext/osgtext.cpp b/examples/osgtext/osgtext.cpp index 5f0689afd..87c2907f8 100644 --- a/examples/osgtext/osgtext.cpp +++ b/examples/osgtext/osgtext.cpp @@ -559,6 +559,7 @@ class UpdateTextOperation : public osg::Operation public: UpdateTextOperation(const osg::Vec3& center, float diameter, osg::Group* group): + osg::Referenced(true), Operation("UpdateTextOperation", true), _center(center), _diameter(diameter), diff --git a/examples/osgthreadedterrain/osgthreadedterrain.cpp b/examples/osgthreadedterrain/osgthreadedterrain.cpp index c8e50925c..766e84d1c 100644 --- a/examples/osgthreadedterrain/osgthreadedterrain.cpp +++ b/examples/osgthreadedterrain/osgthreadedterrain.cpp @@ -83,6 +83,7 @@ class LoadAndCompileOperation : public osg::Operation public: LoadAndCompileOperation(const std::string& filename, osgUtil::IncrementalCompileOperation* ico , osg::RefBlockCount* block): + osg::Referenced(true), Operation("Load and compile Operation", false), _filename(filename), _incrementalCompileOperation(ico), @@ -128,6 +129,7 @@ public: MasterOperation(const std::string& filename, osgUtil::IncrementalCompileOperation* ico): + osg::Referenced(true), Operation("Master reading operation",true), _filename(filename), _incrementalCompileOperation(ico) diff --git a/examples/osgvolume/osgvolume.cpp b/examples/osgvolume/osgvolume.cpp index 113a0d12c..8a9785c60 100644 --- a/examples/osgvolume/osgvolume.cpp +++ b/examples/osgvolume/osgvolume.cpp @@ -306,6 +306,7 @@ class TestSupportOperation: public osg::GraphicsOperation public: TestSupportOperation(): + osg::Referenced(true), osg::GraphicsOperation("TestSupportOperation",false), supported(true), errorMessage(), diff --git a/include/osg/GraphicsThread b/include/osg/GraphicsThread index 60ee085e8..8001cc5f3 100644 --- a/include/osg/GraphicsThread +++ b/include/osg/GraphicsThread @@ -49,6 +49,7 @@ struct OSG_EXPORT GraphicsOperation : public Operation struct OSG_EXPORT SwapBuffersOperation : public GraphicsOperation { SwapBuffersOperation(): + osg::Referenced(true), GraphicsOperation("SwapBuffers",true) {} virtual void operator () (GraphicsContext* context); @@ -65,6 +66,7 @@ struct OSG_EXPORT BarrierOperation : public Operation, public OpenThreads::Barri }; BarrierOperation(int numThreads, PreBlockOp op=NO_OPERATION, bool keep=true): + osg::Referenced(true), Operation("Barrier", keep), OpenThreads::Barrier(numThreads), _preBlockOp(op) {} @@ -81,6 +83,7 @@ struct OSG_EXPORT BarrierOperation : public Operation, public OpenThreads::Barri struct OSG_EXPORT ReleaseContext_Block_MakeCurrentOperation : public GraphicsOperation, public RefBlock { ReleaseContext_Block_MakeCurrentOperation(): + osg::Referenced(true), GraphicsOperation("ReleaseContext_Block_MakeCurrent", false) {} virtual void release(); diff --git a/include/osg/OperationThread b/include/osg/OperationThread index 7e3ec9643..a62157ea1 100644 --- a/include/osg/OperationThread +++ b/include/osg/OperationThread @@ -52,7 +52,6 @@ class Operation : virtual public Referenced public: Operation(const std::string& name, bool keep): - osg::Referenced(true), _name(name), _keep(keep) {} @@ -75,14 +74,12 @@ class Operation : virtual public Referenced /** Do the actual task of this operation.*/ virtual void operator () (Object*) = 0; - protected: +protected: Operation(): - Referenced(true), _keep(false) {} Operation(const Operation& op): - Referenced(true), _name(op._name), _keep(op._keep) {} diff --git a/src/osg/GraphicsThread.cpp b/src/osg/GraphicsThread.cpp index d07854385..5a2182c4f 100644 --- a/src/osg/GraphicsThread.cpp +++ b/src/osg/GraphicsThread.cpp @@ -98,6 +98,7 @@ void ReleaseContext_Block_MakeCurrentOperation::operator () (GraphicsContext* co BlockAndFlushOperation::BlockAndFlushOperation(): + osg::Referenced(true), GraphicsOperation("Block",false) { reset(); @@ -115,6 +116,7 @@ void BlockAndFlushOperation::operator () (GraphicsContext*) } FlushDeletedGLObjectsOperation::FlushDeletedGLObjectsOperation(double availableTime, bool keep): + osg::Referenced(true), GraphicsOperation("FlushDeletedGLObjectsOperation",keep), _availableTime(availableTime) { diff --git a/src/osg/OperationThread.cpp b/src/osg/OperationThread.cpp index 389931736..aec1f98f2 100644 --- a/src/osg/OperationThread.cpp +++ b/src/osg/OperationThread.cpp @@ -22,6 +22,7 @@ using namespace OpenThreads; struct BlockOperation : public Operation, public Block { BlockOperation(): + osg::Referenced(true), Operation("Block",false) { reset(); diff --git a/src/osgUtil/GLObjectsVisitor.cpp b/src/osgUtil/GLObjectsVisitor.cpp index dce01090e..3731cfd34 100644 --- a/src/osgUtil/GLObjectsVisitor.cpp +++ b/src/osgUtil/GLObjectsVisitor.cpp @@ -181,12 +181,14 @@ void GLObjectsVisitor::apply(osg::StateSet& stateset) // GLObjectsOperation::GLObjectsOperation(GLObjectsVisitor::Mode mode): + osg::Referenced(true), osg::GraphicsOperation("GLObjectOperation",false), _mode(mode) { } GLObjectsOperation::GLObjectsOperation(osg::Node* subgraph, GLObjectsVisitor::Mode mode): + osg::Referenced(true), osg::GraphicsOperation("GLObjectOperation",false), _subgraph(subgraph), _mode(mode) diff --git a/src/osgUtil/IncrementalCompileOperation.cpp b/src/osgUtil/IncrementalCompileOperation.cpp index 122cf6d6e..78914f445 100644 --- a/src/osgUtil/IncrementalCompileOperation.cpp +++ b/src/osgUtil/IncrementalCompileOperation.cpp @@ -445,6 +445,7 @@ bool IncrementalCompileOperation::CompileSet::compile(CompileInfo& compileInfo) // IncrementalCompileOperation // IncrementalCompileOperation::IncrementalCompileOperation(): + osg::Referenced(true), osg::GraphicsOperation("IncrementalCompileOperation",true), _flushTimeRatio(0.5), _conservativeTimeRatio(0.5), diff --git a/src/osgUtil/RenderStage.cpp b/src/osgUtil/RenderStage.cpp index c34657dfc..a1fae308c 100644 --- a/src/osgUtil/RenderStage.cpp +++ b/src/osgUtil/RenderStage.cpp @@ -1122,6 +1122,7 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b struct DrawInnerOperation : public osg::Operation { DrawInnerOperation(RenderStage* stage, osg::RenderInfo& renderInfo) : + osg::Referenced(true), osg::Operation("DrawInnerStage",false), _stage(stage), _renderInfo(renderInfo) {} diff --git a/src/osgViewer/Renderer.cpp b/src/osgViewer/Renderer.cpp index b322810e1..c376e2982 100644 --- a/src/osgViewer/Renderer.cpp +++ b/src/osgViewer/Renderer.cpp @@ -352,6 +352,7 @@ static OpenThreads::ReentrantMutex s_drawSerializerMutex; // // Renderer Renderer::Renderer(osg::Camera* camera): + osg::Referenced(true), osg::GraphicsOperation("Renderer",true), _camera(camera), _done(false),