mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-12 04:11:06 -05:00
Make read and write functions of variables thread-safe
This commit is contained in:
@@ -54,6 +54,7 @@ void Variable::Save(obs_data_t *obj) const
|
||||
|
||||
std::string Variable::Value(bool updateLastUsed) const
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
if (updateLastUsed) {
|
||||
UpdateLastUsed();
|
||||
}
|
||||
@@ -73,6 +74,7 @@ std::optional<int> Variable::IntValue() const
|
||||
|
||||
void Variable::SetValue(const std::string &value)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
_previousValue = _value;
|
||||
_value = value;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user