From a9caf3fbe46d809b528f1f9a13c5365c47b12d8f Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Thu, 20 Feb 2020 15:14:48 +0100 Subject: [PATCH] base: avoid wrong warning by Mutex::acquire A _owner is only valid if lock is actually locked. Issue #3612 --- repos/base/include/base/cancelable_lock.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/repos/base/include/base/cancelable_lock.h b/repos/base/include/base/cancelable_lock.h index 8bb30ab18..5c956de94 100644 --- a/repos/base/include/base/cancelable_lock.h +++ b/repos/base/include/base/cancelable_lock.h @@ -71,7 +71,9 @@ class Genode::Cancelable_lock Applicant _owner; - bool lock_owner(Applicant &myself) { return _owner == myself; } + bool lock_owner(Applicant &myself) { + return (_state == LOCKED) && (_owner == myself); } + void lock(Applicant &); public: