<div dir="ltr">
<pre>From f7fd962767c26bd898f00242e576b6edef434af8 Mon Sep 17 00:00:00 2001
From: kenmays <<a href="mailto:maybird1776@yahoo.com">maybird1776@yahoo.com</a>>
Date: Fri, 20 Sep 2019 19:22:40 +0000
Subject: [PATCH] GLView.cpp: Fix GL lock/unlock issue

---
 src/hgl/GLView.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/hgl/GLView.cpp b/src/hgl/GLView.cpp
index 9ae5b5c83ac..05e12fc52df 100644
--- a/src/hgl/GLView.cpp
+++ b/src/hgl/GLView.cpp
@@ -51,6 +51,7 @@ BGLView::BGLView(BRect rect, const char* name, ulong resizingMode, ulong mode,
        fDitherMap(NULL)
 {
        fRoster = new GLRendererRoster(this, options);
+       fRenderer = fRoster->GetRenderer();
 }
 
 
@@ -68,16 +69,16 @@ BGLView::LockGL()
        // TODO: acquire the OpenGL API lock it on this glview
 
        fDisplayLock.Lock();
-       if (fRenderer)
-               fRenderer->LockGL();
+       if (fRenderer != NULL && fDisplayLock.CountLocks() == 1)
+               fRenderer->LockGL();
 }
 
 
 void
 BGLView::UnlockGL()
 {
-       if (fRenderer)
-               fRenderer->UnlockGL();
+       if (fRenderer != NULL && fDisplayLock.CountLocks() == 1)
+               fRenderer->UnlockGL();
        fDisplayLock.Unlock();
 
        // TODO: release the GL API lock to others glviews
-- 
2.22.0
</pre>

</div>