From 871da625bada1758a8a24e18c29653916afd12bc Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 23 Jul 2003 08:48:23 +0000 Subject: [PATCH] Made the keyboard mouse callback a ref_ptr<> managed object to fix ref count problem. --- examples/osgcameragroup/osgcameragroup.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/osgcameragroup/osgcameragroup.cpp b/examples/osgcameragroup/osgcameragroup.cpp index 3a6037c67..77015c634 100644 --- a/examples/osgcameragroup/osgcameragroup.cpp +++ b/examples/osgcameragroup/osgcameragroup.cpp @@ -137,10 +137,10 @@ int main( int argc, char **argv ) (new Producer::KeyboardMouse(cg.getCamera(0)->getRenderSurface())); - MyKeyboardMouseCallback kbmcb; + osg::ref_ptr kbmcb = new MyKeyboardMouseCallback; // register the callback with the keyboard mouse manger. - kbm->setCallback( &kbmcb ); + kbm->setCallback( kbmcb.get() ); kbm->startThread(); // set the scene to render @@ -159,7 +159,7 @@ int main( int argc, char **argv ) osgUtil::UpdateVisitor update; - while( !kbmcb.done() ) + while( !kbmcb->done() ) { // syncronize to the when cull and draw threads have completed. cg.sync(); @@ -168,7 +168,7 @@ int main( int argc, char **argv ) // call all node update callbacks and animations. cg.getSceneData()->accept(update); - tb->input( kbmcb.mx(), kbmcb.my(), kbmcb.mbutton() ); + tb->input( kbmcb->mx(), kbmcb->my(), kbmcb->mbutton() ); // update the main producer camera cg.setViewByMatrix(tb->getMatrix());