================ 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. ================ */
| 3238 | ================ |
| 3239 | */ |
| 3240 | void idEntity::DeconstructScriptObject( void ) { |
| 3241 | idThread *thread; |
| 3242 | const function_t *destructor; |
| 3243 | |
| 3244 | // don't bother calling the script object's destructor on map shutdown |
| 3245 | if ( gameLocal.GameState() == GAMESTATE_SHUTDOWN ) { |
| 3246 | return; |
| 3247 | } |
| 3248 | |
| 3249 | // call script object's destructor |
| 3250 | destructor = scriptObject.GetDestructor(); |
| 3251 | if ( destructor ) { |
| 3252 | // start a thread that will run immediately and be destroyed |
| 3253 | thread = new idThread(); |
| 3254 | thread->SetThreadName( name.c_str() ); |
| 3255 | thread->CallFunction( this, destructor, true ); |
| 3256 | thread->Execute(); |
| 3257 | delete thread; |
| 3258 | } |
| 3259 | } |
| 3260 | |
| 3261 | /* |
| 3262 | ================ |
nothing calls this directly
no test coverage detected