1
0
mirror of https://github.com/ceph/ceph synced 2024-12-17 08:57:28 +00:00

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 <haomai@xsky.com>
This commit is contained in:
Haomai Wang 2016-07-10 00:15:55 +08:00
parent 12c068365c
commit 6ea50dabd6

View 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() {