Don't lock OpenGL context twice
Use GAL_DRAWING_CONTEXT as this unlocks the context in its destructor, so that when an exception is thrown inside the `try` block, it should automatically unlock before we switch backend. Fixes https://gitlab.com/kicad/code/kicad/-/issues/10840
This commit is contained in:
parent
4442f76add
commit
1b6fe615e5
|
@ -213,6 +213,7 @@ void EDA_DRAW_PANEL_GAL::DoRePaint()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cntUpd.Start();
|
cntUpd.Start();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_view->UpdateItems();
|
m_view->UpdateItems();
|
||||||
|
@ -229,9 +230,7 @@ void EDA_DRAW_PANEL_GAL::DoRePaint()
|
||||||
cntUpd.Stop();
|
cntUpd.Stop();
|
||||||
|
|
||||||
cntCtx.Start();
|
cntCtx.Start();
|
||||||
int cookie = rand();
|
KIGFX::GAL_DRAWING_CONTEXT ctx( m_gal );
|
||||||
m_gal->LockContext( cookie );
|
|
||||||
m_gal->BeginDrawing();
|
|
||||||
cntCtx.Stop();
|
cntCtx.Stop();
|
||||||
|
|
||||||
if( m_view->IsTargetDirty( KIGFX::TARGET_OVERLAY )
|
if( m_view->IsTargetDirty( KIGFX::TARGET_OVERLAY )
|
||||||
|
@ -273,9 +272,6 @@ void EDA_DRAW_PANEL_GAL::DoRePaint()
|
||||||
m_gal->DrawCursor( m_viewControls->GetCursorPosition() );
|
m_gal->DrawCursor( m_viewControls->GetCursorPosition() );
|
||||||
|
|
||||||
cntCtxDestroy.Start();
|
cntCtxDestroy.Start();
|
||||||
m_gal->EndDrawing();
|
|
||||||
m_gal->UnlockContext( cookie );
|
|
||||||
cntCtxDestroy.Stop();
|
|
||||||
}
|
}
|
||||||
catch( std::exception& err )
|
catch( std::exception& err )
|
||||||
{
|
{
|
||||||
|
@ -294,6 +290,9 @@ void EDA_DRAW_PANEL_GAL::DoRePaint()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ctx goes out of scope here so destructor would be called
|
||||||
|
cntCtxDestroy.Stop();
|
||||||
|
|
||||||
|
|
||||||
if( isDirty )
|
if( isDirty )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue