Don't init wxBitmaps before GUI is ready

Init'ing static wxBitmaps in the global scope happens before the GUI is
ready, which segfaults, at least on GTK+. This can happen in, for
example, the Python module. In normal use, the singletop/kicad
loader has initialised the GUI first, so it doesn't manifest there.
This commit is contained in:
John Beard 2017-03-01 17:59:07 +08:00 committed by Maciej Suminski
parent 8526935183
commit 4547b2e26d
1 changed files with 7 additions and 7 deletions

View File

@ -167,13 +167,6 @@ static const char * rightarrow_alternate_xpm[] = {
"..oO "};
static wxBitmap rightArrowBitmap( rightarrow_xpm );
static wxBitmap rightArrowAlternateBitmap( rightarrow_alternate_xpm );
static wxBitmap blankBitmap( clear_xpm );
static wxBitmap blankAlternateBitmap( clear_alternate_xpm );
ROW_ICON_PROVIDER::ROW_ICON_PROVIDER( bool aAlt ):
m_alt( aAlt )
{}
@ -182,6 +175,13 @@ ROW_ICON_PROVIDER::ROW_ICON_PROVIDER( bool aAlt ):
const wxBitmap& ROW_ICON_PROVIDER::GetIndicatorIcon(
INDICATOR_ICON::ICON_ID aIconId ) const
{
// need to wait until UI is ready before construction
// so can't go in the global scope
static const wxBitmap rightArrowBitmap( rightarrow_xpm );
static const wxBitmap rightArrowAlternateBitmap( rightarrow_alternate_xpm );
static const wxBitmap blankBitmap( clear_xpm );
static const wxBitmap blankAlternateBitmap( clear_alternate_xpm );
const bool on = ( aIconId == STATE::ON );
if( m_alt )