Branch: Tag:

2015-09-07

2015-09-07 08:02:36 by Arne Goedeke <el@laramies.com>

Threads: Mutex()->lock() needs to survive cleanup on exit.

In some cases lfun::destroy() calls lock() in a mutex. If this happens
during cleanup on exit phase, Pike_interpreter.thread_state->thread_obj
is already NULL.

2394:    THIS_KEY->mut=0;    THIS_KEY->mutex_obj = NULL;    THIS_KEY->owner = Pike_interpreter.thread_state; -  add_ref(THIS_KEY->owner_obj = Pike_interpreter.thread_state->thread_obj); +  THIS_KEY->owner_obj = Pike_interpreter.thread_state->thread_obj; +  if (THIS_KEY->owner_obj) +  add_ref(THIS_KEY->owner_obj);    THIS_KEY->initialized=1;   }