================ idEntity::DeconstructScriptObject Called during idEntity::~idEntity. Calls the destructor on the script object. Can be overridden by subclasses when a thread doesn't need to be allocated. Not called during idGameLocal::MapShutdown. ================ */
| 3142 | ================ |
| 3143 | */ |
| 3144 | void idEntity::DeconstructScriptObject( void ) { |
| 3145 | idThread *thread; |
| 3146 | const function_t *destructor; |
| 3147 | |
| 3148 | // don't bother calling the script object's destructor on map shutdown |
| 3149 | if ( gameLocal.GameState() == GAMESTATE_SHUTDOWN ) { |
| 3150 | return; |
| 3151 | } |
| 3152 | |
| 3153 | // call script object's destructor |
| 3154 | destructor = scriptObject.GetDestructor(); |
| 3155 | if ( destructor ) { |
| 3156 | // start a thread that will run immediately and be destroyed |
| 3157 | thread = new idThread(); |
| 3158 | thread->SetThreadName( name.c_str() ); |
| 3159 | thread->CallFunction( this, destructor, true ); |
| 3160 | thread->Execute(); |
| 3161 | delete thread; |
| 3162 | } |
| 3163 | } |
| 3164 | |
| 3165 | /* |
| 3166 | ================ |
nothing calls this directly
no test coverage detected