From 7b95adff42ca55aaac61d6f00bad8ffb233da975 Mon Sep 17 00:00:00 2001 From: ExMix Date: Wed, 8 Jul 2015 16:31:18 +0300 Subject: [PATCH] review fixes --- qt/draw_widget.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp index 28a13ceaf4..77fccdbfba 100644 --- a/qt/draw_widget.cpp +++ b/qt/draw_widget.cpp @@ -104,11 +104,9 @@ bool IsLocationEmulation(QMouseEvent * e) void DrawWidget::PrepareShutdown() { - { - // Discard current and all future Swap requests - m_contextFactory->shutDown(); - frameSwappedSlot(NotInitialized); - } + // Discard current and all future Swap requests + m_contextFactory->shutDown(); + frameSwappedSlot(NotInitialized); // Shutdown engine. FR have ogl context in this moment and can delete OGL resources // PrepareToShutdown make FR::join and after this call we can bind OGL context to gui thread @@ -207,10 +205,9 @@ bool IsLocationEmulation(QMouseEvent * e) ASSERT(m_contextFactory == nullptr, ()); m_ratio = devicePixelRatio(); - QOpenGLContext * ctx = context(); QtOGLContextFactory::TRegisterThreadFn regFn = bind(&DrawWidget::CallRegisterThread, this, _1); QtOGLContextFactory::TSwapFn swapFn = bind(&DrawWidget::CallSwap, this); - m_contextFactory = make_unique_dp(ctx, QThread::currentThread(), regFn, swapFn); + m_contextFactory = make_unique_dp(context(), QThread::currentThread(), regFn, swapFn); CreateEngine(); LoadState(); @@ -243,18 +240,15 @@ bool IsLocationEmulation(QMouseEvent * e) if (isExposed()) { m_swapMutex.lock(); - bool needUnlock = true; if (m_state == Render) { unique_lock waitContextLock(m_waitContextMutex); m_state = WaitContext; - needUnlock = false; m_swapMutex.unlock(); m_waitContextCond.wait(waitContextLock, [this](){ return m_state != WaitContext; }); } - - if (needUnlock) + else m_swapMutex.unlock(); }