From 666568a5139b2e07f6ea30010f1ea669745fe417 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 6 Feb 2019 22:08:25 +0100 Subject: [PATCH] prc: fix recursive use of non-recursive mutex --- dtool/src/prc/configVariableBool.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dtool/src/prc/configVariableBool.cxx b/dtool/src/prc/configVariableBool.cxx index 701f40c65d..27556f3f2b 100644 --- a/dtool/src/prc/configVariableBool.cxx +++ b/dtool/src/prc/configVariableBool.cxx @@ -12,6 +12,7 @@ */ #include "configVariableBool.h" +#include "mutexImpl.h" /** * Refreshes the cached value. @@ -21,7 +22,10 @@ reload_value() const { // NB. MSVC doesn't guarantee that this mutex is initialized in a // thread-safe manner. But chances are that the first time this is called // is at static init time, when there is no risk of data races. - static MutexImpl lock; + + // This needs to be a recursive mutex, because get_bool_word() may end up + // indirectly querying another bool config variable. + static ReMutexImpl lock; lock.lock(); // We check again for cache validity since another thread may have beaten