diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs index 887d1861..55bfac84 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueProducer.cs @@ -669,6 +669,12 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger lock (Core.Lock) { + // If we are replacing a buffer that has already been queued, make sure we release the references. + if (Core.Slots[slot].BufferState == BufferState.Queued) + { + Core.Slots[slot].GraphicBuffer.Object.DecrementNvMapHandleRefCount(Core.Owner); + } + Core.Slots[slot].BufferState = BufferState.Free; Core.Slots[slot].Fence = AndroidFence.NoFence; Core.Slots[slot].RequestBufferCalled = false;