Ensure dtor throws into catch block
Explicitly destruct the GAL context to get StopDrawing throws in the proper try block Fixes https://gitlab.com/kicad/code/kicad/issues/12117
This commit is contained in:
parent
c1da59b560
commit
519084546e
|
@ -254,6 +254,9 @@ void EDA_DRAW_PANEL_GAL::DoRePaint()
|
||||||
|
|
||||||
cntUpd.Stop();
|
cntUpd.Stop();
|
||||||
|
|
||||||
|
// GAL_DRAWING_CONTEXT can throw in the dtor, so we need to scope
|
||||||
|
// the full lifetime inside the try block
|
||||||
|
{
|
||||||
cntCtx.Start();
|
cntCtx.Start();
|
||||||
KIGFX::GAL_DRAWING_CONTEXT ctx( m_gal );
|
KIGFX::GAL_DRAWING_CONTEXT ctx( m_gal );
|
||||||
cntCtx.Stop();
|
cntCtx.Stop();
|
||||||
|
@ -298,6 +301,10 @@ void EDA_DRAW_PANEL_GAL::DoRePaint()
|
||||||
|
|
||||||
cntCtxDestroy.Start();
|
cntCtxDestroy.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ctx goes out of scope here so destructor would be called
|
||||||
|
cntCtxDestroy.Stop();
|
||||||
|
}
|
||||||
catch( std::exception& err )
|
catch( std::exception& err )
|
||||||
{
|
{
|
||||||
if( GAL_FALLBACK != m_backend )
|
if( GAL_FALLBACK != m_backend )
|
||||||
|
@ -315,10 +322,6 @@ void EDA_DRAW_PANEL_GAL::DoRePaint()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ctx goes out of scope here so destructor would be called
|
|
||||||
cntCtxDestroy.Stop();
|
|
||||||
|
|
||||||
|
|
||||||
if( isDirty )
|
if( isDirty )
|
||||||
{
|
{
|
||||||
KI_TRACE( traceGalProfile, "View timing: %s %s %s %s %s\n",
|
KI_TRACE( traceGalProfile, "View timing: %s %s %s %s %s\n",
|
||||||
|
|
Loading…
Reference in New Issue