From 08b69435ef6912abbca4b2830eac9e78776ef4d5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 3 Dec 2020 12:25:45 +0200 Subject: Fix lock/unlock order --- libbuild2/cc/common.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libbuild2/cc/common.cxx b/libbuild2/cc/common.cxx index c7ca7bc..2f55dcb 100644 --- a/libbuild2/cc/common.cxx +++ b/libbuild2/cc/common.cxx @@ -856,7 +856,6 @@ namespace build2 } target_lock al (a != nullptr ? lock (act, *a, true) : target_lock ()); - target_lock sl (s != nullptr ? lock (act, *s, true) : target_lock ()); if (al && al.offset == target::offset_matched) { @@ -864,6 +863,8 @@ namespace build2 al.unlock (); } + target_lock sl (s != nullptr ? lock (act, *s, true) : target_lock ()); + if (sl && sl.offset == target::offset_matched) { assert ((*s)[act].rule == &file_rule::rule_match); -- cgit v1.1