]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/Event: ensure not refer to member variable which may destroyed 10369/head
authorHaomai Wang <haomai@xsky.com>
Sat, 9 Jul 2016 16:15:55 +0000 (00:15 +0800)
committerHaomai Wang <haomai@xsky.com>
Wed, 20 Jul 2016 12:44:32 +0000 (20:44 +0800)
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 <haomai@xsky.com>
src/msg/async/Event.h

index 89bede958c80393d190ec92248895b5ca60e3797..a320489ceda2c13513e2dc591ce5e5ceecee8a5a 100644 (file)
@@ -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() {