Thanks  Jean-Sébastien Guay
  1.  I already update my user info.
  2. I  have another question, when viewer.frame()  which thread listening 
windows message(example mouse clicked,keyboard down ,up etc) ,and when 
  i update my scene node in updatecallback,How threads guarantee sequence?
   
  for example :
    mouse PUSH
   {
      
       mynode->setUpdateCallback(new mycallback() );
   
  }
  mouse RELEASE
  {
      mynode->setUpdateCallback(new mycallback() );
      
  }
   
   
  and  all threads execute sequence synchronize with above code?
   
  Thanks.  
    
Jean-Sébastien Guay <[EMAIL PROTECTED]> 写道:
  Hi ???,

First of all, a little mailing list etiquette:
1. could you please sign your posts, it's polite to let others know how 
to address you.
2. When asking a new question, you should start a new thread (start a 
new message and not reply to another message).

Now, to your question.

> scene->setUpdateCallback(new RotateCallBack());
....
> 
> My question is when next mouse PUSH , 
> scene->setUpdateCallback(new RotateCallBack()) call again and 
> new a RotateCallBack object.
> But can last time RotateCallBack object is auto-delete?

You think there may be a memory leak? Look at the code for osg::Node 
(header and cpp file).

osg::Node::setUpdateCallback(NodeCallback* nc) does some checking, but 
in the end, does this:

// set the app callback itself.
_updateCallback = nc;

and _updateCallback is declared thus:

ref_ptr _updateCallback;

So it's a ref_ptr. Reference pointers manage the reference count of the 
pointed objects, and if that count goes to 0, the object deletes itself. 
So when setUpdateCallback() assigns a new callback to _updateCallback, 
the old one's ref count decreases by 1, and the new one's ref count 
increases by 1. If the old one's ref count comes to 0, it will delete 
itself.

See osg::Referenced and osg::ref_ptr for details.

As a general tip, I find that generating the doxygen documentation for 
the OSG source tree with INLINE_SOURCES = YES helps a lot when learning 
about how OSG does things. It gives you a nice way to browse the 
doxygen, and then go down to the actual code directly, with 
cross-references everywhere.

Hope this helps,

J-S
-- 
______________________________________________________
Jean-Sebastien Guay [EMAIL PROTECTED]
http://www.cm-labs.com/
http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


       
---------------------------------
 雅虎邮箱,您的终生邮箱!
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to