Update of /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29801/src/libopenvrml/openvrml
Modified Files:
browser.cpp
Log Message:
Ensure that scene pointers for the active viewpoint_node and the active navigation_info_node point to scenes that are either the browser's root_scene or one of its descendants.
Index: browser.cpp
===================================================================
RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/browser.cpp,v
retrieving revision 1.217
retrieving revision 1.218
diff -C2 -d -r1.217 -r1.218
*** browser.cpp 1 Jun 2007 05:34:02 -0000 1.217
--- browser.cpp 1 Jun 2007 06:08:44 -0000 1.218
***************
*** 5918,5926 ****
*
* @param[in] viewpoint a @c viewpoint_node.
*/
void openvrml::browser::active_viewpoint(viewpoint_node & viewpoint)
OPENVRML_NOTHROW
{
! read_write_mutex::scoped_write_lock lock(this->active_viewpoint_mutex_);
this->active_viewpoint_ = &viewpoint;
}
--- 5918,5938 ----
*
* @param[in] viewpoint a @c viewpoint_node.
+ *
+ * @pre @p viewpoint.scene() == @c this->root_scene()
*/
void openvrml::browser::active_viewpoint(viewpoint_node & viewpoint)
OPENVRML_NOTHROW
{
! read_write_mutex::scoped_read_lock scene_lock(this->scene_mutex_);
! read_write_mutex::scoped_write_lock
! active_viewpoint_lock(this->active_viewpoint_mutex_);
! # ifndef NDEBUG
! scene * root_scene = 0;
! for (root_scene = viewpoint.scene();
! root_scene->parent();
! root_scene = root_scene->parent())
! {}
! # endif
! assert(root_scene == this->scene_.get());
this->active_viewpoint_ = &viewpoint;
}
***************
*** 5958,5967 ****
*
* @param[in] nav_info a @c navigation_info_node.
*/
void openvrml::browser::active_navigation_info(navigation_info_node & nav_info)
OPENVRML_NOTHROW
{
read_write_mutex::scoped_write_lock
! lock(this->active_navigation_info_mutex_);
this->active_navigation_info_ = &nav_info;
}
--- 5970,5990 ----
*
* @param[in] nav_info a @c navigation_info_node.
+ *
+ * @pre @p viewpoint.scene() == @c this->root_scene()
*/
void openvrml::browser::active_navigation_info(navigation_info_node & nav_info)
OPENVRML_NOTHROW
{
+ read_write_mutex::scoped_read_lock scene_lock(this->scene_mutex_);
read_write_mutex::scoped_write_lock
! active_navigation_info_lock(this->active_navigation_info_mutex_);
! # ifndef NDEBUG
! scene * root_scene = 0;
! for (root_scene = nav_info.scene();
! root_scene->parent();
! root_scene = root_scene->parent())
! {}
! # endif
! assert(root_scene == this->scene_.get());
this->active_navigation_info_ = &nav_info;
}
|