From 1384584af6a006b11c34cb6b41a82029f5333f77 Mon Sep 17 00:00:00 2001 From: fzurita Date: Sun, 13 Oct 2019 21:40:11 -0400 Subject: [PATCH] Fix threaded OpenGL lockup when trying to remove invalid buffer --- .../OpenGLContext/ThreadedOpenGl/RingBufferPool.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Graphics/OpenGLContext/ThreadedOpenGl/RingBufferPool.cpp b/src/Graphics/OpenGLContext/ThreadedOpenGl/RingBufferPool.cpp index b3ec66af..a5275c8a 100644 --- a/src/Graphics/OpenGLContext/ThreadedOpenGl/RingBufferPool.cpp +++ b/src/Graphics/OpenGLContext/ThreadedOpenGl/RingBufferPool.cpp @@ -139,10 +139,12 @@ const char* RingBufferPool::getBufferFromPool(PoolBufferPointer _poolBufferPoint void RingBufferPool::removeBufferFromPool(PoolBufferPointer _poolBufferPointer) { - std::unique_lock lock(m_mutex); - m_inUseStartOffset = _poolBufferPointer.m_offset + _poolBufferPointer.m_realSize; - m_full = false; - m_condition.notify_one(); + if (_poolBufferPointer.isValid()) { + std::unique_lock lock(m_mutex); + m_inUseStartOffset = _poolBufferPointer.m_offset + _poolBufferPointer.m_realSize; + m_full = false; + m_condition.notify_one(); + } } }