base: resolve dead lock in weak pointer templates

This commit eliminates the mutual interlaced taking of destruction lock,
list lock and weak pointer locks that could lead to a dead-lock situation
when a lock pointer was tried to construct while a weak object is in
destruction progress.
Now, all weak pointers are invalidated and dequeued at the very
beginning of the weak object's destruction. Moreover, before a weak pointer
gets invalidated during destruction of a weak object, it gets dequeued, and
the list lock is freed again to avoid the former dead-lock.

Fix #1607
This commit is contained in:
Stefan Kalkowski
2015-07-02 11:52:57 +02:00
committed by Norman Feske
parent 64831c63c9
commit 0f05fa6fd4
10 changed files with 141 additions and 72 deletions

View File

@ -126,6 +126,9 @@ class View : public Same_buffer_list_elem,
virtual ~View()
{
/* invalidate weak pointers to this object */
lock_for_destruction();
/* break link to our parent */
if (_parent)
_parent->remove_child(*this);