Prevent another GAL crash on init due to psuedo-race

Fixes Sentry KICAD-98


(cherry picked from commit 9647a22e50)
This commit is contained in:
Marek Roszko 2023-02-13 19:10:33 -05:00 committed by Mark Roszko
parent f56fcb0a14
commit 7a2a51ad44
1 changed files with 8 additions and 9 deletions

View File

@ -58,7 +58,13 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
const wxPoint& aPosition, const wxSize& aSize,
KIGFX::GAL_DISPLAY_OPTIONS& aOptions, GAL_TYPE aGalType ) :
wxScrolledCanvas( aParentWindow, aWindowId, aPosition, aSize ),
m_MouseCapturedLost( false ),
m_parent( aParentWindow ),
m_edaFrame( nullptr ),
m_lastRefresh( 0 ),
m_pendingRefresh( false ),
m_drawing( false ),
m_drawingEnabled( false ),
m_gal( nullptr ),
m_view( nullptr ),
m_painter( nullptr ),
@ -70,11 +76,10 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
m_stealsFocus( true ),
m_statusPopup( nullptr )
{
m_parent = aParentWindow;
m_MouseCapturedLost = false;
m_PaintEventCounter = std::make_unique<PROF_COUNTER>( "Draw panel paint events" );
m_minRefreshPeriod = 13; // 77 FPS (minus render time) by default
SetLayoutDirection( wxLayout_LeftToRight );
m_edaFrame = dynamic_cast<EDA_DRAW_FRAME*>( m_parent );
@ -146,12 +151,6 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
Connect( eventType, wxEventHandler( EDA_DRAW_PANEL_GAL::OnEvent ), nullptr,
m_eventDispatcher );
m_pendingRefresh = false;
m_drawing = false;
m_drawingEnabled = false;
m_minRefreshPeriod = 13; // 77 FPS (minus render time) by default
// Set up timer that prevents too frequent redraw commands
m_refreshTimer.SetOwner( this );
Connect( m_refreshTimer.GetId(), wxEVT_TIMER,