From b3e2a6d58f9c535b9bda520254806fbc0ea00b53 Mon Sep 17 00:00:00 2001 From: Thog Date: Sun, 5 Jan 2020 16:07:28 +0100 Subject: [PATCH] Fix ReactiveObject initial event not being propagated with boolean types. This fix the logger configuration initial state being ignored. --- Ryujinx.Common/ReactiveObject.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Ryujinx.Common/ReactiveObject.cs b/Ryujinx.Common/ReactiveObject.cs index be30e9b2c5..33aa218a77 100644 --- a/Ryujinx.Common/ReactiveObject.cs +++ b/Ryujinx.Common/ReactiveObject.cs @@ -6,6 +6,7 @@ namespace Ryujinx.Common public class ReactiveObject { private ReaderWriterLock _readerWriterLock = new ReaderWriterLock(); + private bool _isInitialized = false; private T _value; public event EventHandler> Event; @@ -25,12 +26,15 @@ namespace Ryujinx.Common _readerWriterLock.AcquireWriterLock(Timeout.Infinite); T oldValue = _value; - - _value = value; + + bool oldIsInitialized = _isInitialized; + + _isInitialized = true; + _value = value; _readerWriterLock.ReleaseWriterLock(); - if (oldValue == null || !oldValue.Equals(_value)) + if (!oldIsInitialized || !oldValue.Equals(_value)) { Event?.Invoke(this, new ReactiveEventArgs(oldValue, value)); }