From 7e9aea9de18ab183ef5e12261f92c3997d607dea Mon Sep 17 00:00:00 2001 From: adfaure Date: Mon, 12 Sep 2016 11:54:24 +0200 Subject: [PATCH] fix segmentation fault when process try to unlock a not locked mutex --- src/simix/smx_synchro.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/simix/smx_synchro.cpp b/src/simix/smx_synchro.cpp index 782547113b..b1a6485584 100644 --- a/src/simix/smx_synchro.cpp +++ b/src/simix/smx_synchro.cpp @@ -163,6 +163,8 @@ bool Mutex::try_lock(smx_actor_t issuer) void Mutex::unlock(smx_actor_t issuer) { XBT_IN("(%p, %p)", this, issuer); + if(!this->locked) + THROWF(mismatch_error, 0, "Cannot release that mutex: it was not locked."); /* If the mutex is not owned by the issuer, that's not good */ if (issuer != this->owner) -- 2.20.1