|
From: Braden M. <br...@us...> - 2006-02-15 08:32:40
|
Update of /cvsroot/openvrml/openvrml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5584 Modified Files: ChangeLog Log Message: Ensure that externproto_node_type and externproto_node references are cleared even if PROTO loading fails. Index: ChangeLog =================================================================== RCS file: /cvsroot/openvrml/openvrml/ChangeLog,v retrieving revision 1.1134 retrieving revision 1.1135 diff -C2 -d -r1.1134 -r1.1135 *** ChangeLog 12 Feb 2006 09:40:16 -0000 1.1134 --- ChangeLog 15 Feb 2006 08:32:31 -0000 1.1135 *************** *** 1,2 **** --- 1,57 ---- + 2006-02-14 Braden McDaniel <br...@en...> + + Ensure that externproto_node_type and externproto_node references + are cleared even if PROTO loading fails. + + * src/libopenvrml/openvrml/browser.cpp + (externproto_node_class): Inherit boost::enable_shared_from_this. + Changed proto_node_class_ from a shared_ptr to a weak_ptr. + Changed externproto_node_types_ from a vector of shared_ptrs to a + vector of weak_ptrs. Added member + externproto_node_types_cleared_. Added member functions + externproto_node_types_cleared and clear_externproto_node_types. + (externproto_node_type): Added member node_class_. Added member + function clear_externproto_nodes. + (externproto_node_class::load_proto::operator()() const): Use a + scope_guard to call + externproto_node_class::clear_externproto_node_types; this + function should be called regardless of whether a PROTO is + successfully loaded. + (externproto_node_class::externproto_node_class(openvrml::scene &, + const std::vector<std::string> &>)): Initialize + externproto_node_types_cleared_ to false. + (externproto_node_class::externproto_node_types_cleared() const): + Added function. Indicate whether the list of + externproto_node_types has been cleared. + (externproto_node_class::do_create_type(const std::string &, const + openvrml::node_interface_set &) const): Lock the proto_node_class_ + weak_ptr; pass a shared_ptr to this to the externproto_node_type + constructor. + (externproto_node_class::set_proto_node_class(const + boost::weak_ptr<openvrml::proto_node_class> &)): Changed to take a + weak_ptr argument. Lock the externproto_node_type weak_ptrs. + (externproto_node_class::clear_externproto_node_types()): Added + function. Call externproto_node_type::clear_externproto_nodes for + each node type in the list and clear the list. + (externproto_node_type::externproto_node_type(const + boost::Shared_ptr<const externproto_node_class> &, const + std::string &, const openvrml::node_interface_set &)): Changed to + take a shared_ptr to the externproto_node_class. + (externproto_node_type::set_proto_node_type(openvrml::proto_node_class&)): + Moved clearing the externproto_nodes_ to + externproto_node_type::clear_externproto_nodes. + (externproto_node_type::clear_externproto_nodes()): Clear the list + of externproto_nodes. + (externproto_node_type::do_create_node(const + boost::shared_ptr<openvrml::scope> &, const + openvrml::initial_value_map &) const): Only add the created node + to the externproto_node_type's list of nodes if + externproto_node_class::externproto_node_types_cleared returns + false. + (openvrml::browser::node_class_map::~node_class_map()): Added + debugging code to confirm that the node_class shared_ptrs in the + node_class_map are the only remaining owning references to the + node_classes. + 2006-02-12 Braden McDaniel <br...@en...> |