Changeset 77 for trunk/src/object.cc
- Timestamp:
- 06/01/13 22:47:44 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/object.cc
r66 r77 9 9 #include "nv/root.hh" 10 10 #include "nv/types.hh" 11 #include "nv/lua/lua_state.hh" 12 #include "nv/uid.hh" 11 13 12 14 using namespace nv; … … 19 21 } 20 22 21 object::object( root* aroot, const string& aid , uid auid)22 : m_root( aroot ), m_id(aid), m_name(), m_uid( auid), m_lua_index(-2), m_parent( nullptr ), m_children(), m_child_count(0)23 object::object( root* aroot, const string& aid ) 24 : m_root( aroot ), m_id(aid), m_name(), m_uid( 0 ), m_lua_index(-2), m_parent( nullptr ), m_children(), m_child_count(0) 23 25 { 24 // uid_store::register_object( this, auid ); 26 if ( m_root ) 27 { 28 uid_store* store = get_root()->get_uid_store(); 29 lua::state* state = get_root()->get_lua_state(); 30 if (store) 31 { 32 m_uid = store->insert( this ); 33 } 34 if (state) 35 { 36 m_lua_index = state->register_object( this ); 37 } 38 } 39 25 40 } 26 41 … … 77 92 object::~object() 78 93 { 79 // if ( m_lua_index != lua::ref_none ) 80 // { 81 // lua::state::get()->unregister_object( this ); 82 // } 83 // uid_store::unregister_object( m_uid ); 94 if ( m_lua_index != lua::ref_none ) 95 { 96 lua::state* state = get_root()->get_lua_state(); 97 state->unregister_object( this ); 98 } 99 if ( m_uid != 0 && m_root ) 100 { 101 uid_store* store = get_root()->get_uid_store(); 102 if (store) store->remove( m_uid ); 103 } 84 104 detach(); 85 105 destroy_children();
Note: See TracChangeset
for help on using the changeset viewer.