From: Haomai Wang Date: Sat, 9 Jul 2016 16:15:55 +0000 (+0800) Subject: msg/async/Event: ensure not refer to member variable which may destroyed X-Git-Tag: ses5-milestone5~295^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6ea50dabd68db9a3199e1d3c16b82ec8774ad897;p=ceph.git msg/async/Event: ensure not refer to member variable which may destroyed If nonwait is false, another thread is waiting for complete. After calling f() this thread will notify for finishing and at this moment another thread will destroy this C_submit_event right now. So we may refer to nonwait when C_submit_event is disappeared. Fixes: http://tracker.ceph.com/issues/16714 Signed-off-by: Haomai Wang --- diff --git a/src/msg/async/Event.h b/src/msg/async/Event.h index 89bede958c80..a320489ceda2 100644 --- a/src/msg/async/Event.h +++ b/src/msg/async/Event.h @@ -183,8 +183,9 @@ class EventCenter { lock.lock(); cond.notify_all(); done = true; + bool del = nonwait; lock.unlock(); - if (nonwait) + if (del) delete this; } void wait() {