Avoid drawing into a non valid gl context when closing the DIALOG_PAD_PROPERTIES dialog
Fixes: lp:1729843 https://bugs.launchpad.net/kicad/+bug/
This commit is contained in:
parent
c932e4af1b
commit
7d24a576e4
|
@ -102,7 +102,9 @@ void GL_CONTEXT_MANAGER::UnlockCtx( wxGLContext* aContext )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxLogDebug( "Trying to unlock GL context mutex from a wrong context" );
|
wxLogDebug(
|
||||||
|
"Trying to unlock GL context mutex from a wrong context: aContext %p m_glCtx %p",
|
||||||
|
aContext, m_glCtx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,18 @@ void DIALOG_PAD_PROPERTIES::OnInitDialog( wxInitDialogEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DIALOG_PAD_PROPERTIES::OnCancel( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
// Mandatory to avoid m_panelShowPadGal trying to draw something
|
||||||
|
// in a non valid context during closing process:
|
||||||
|
if( m_parent->IsGalCanvasActive() )
|
||||||
|
m_panelShowPadGal->StopDrawing();
|
||||||
|
|
||||||
|
// Now call default handler for wxID_CANCEL command event
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_PAD_PROPERTIES::enablePrimitivePage( bool aEnable )
|
void DIALOG_PAD_PROPERTIES::enablePrimitivePage( bool aEnable )
|
||||||
{
|
{
|
||||||
// Enable or disable the widgets in page managing custom shape primitives
|
// Enable or disable the widgets in page managing custom shape primitives
|
||||||
|
@ -188,8 +200,8 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas()
|
||||||
m_panelShowPadGal->Show();
|
m_panelShowPadGal->Show();
|
||||||
m_panelShowPad->Hide();
|
m_panelShowPad->Hide();
|
||||||
auto view = m_panelShowPadGal->GetView();
|
auto view = m_panelShowPadGal->GetView();
|
||||||
// gives a non null grid size (0.01mm) because GAL layer does not like a 0 size grid:
|
// gives a non null grid size (0.001mm) because GAL layer does not like a 0 size grid:
|
||||||
double gridsize = 0.01 * IU_PER_MM;
|
double gridsize = 0.001 * IU_PER_MM;
|
||||||
view->GetGAL()->SetGridSize( VECTOR2D( gridsize, gridsize ) );
|
view->GetGAL()->SetGridSize( VECTOR2D( gridsize, gridsize ) );
|
||||||
view->Add( m_dummyPad );
|
view->Add( m_dummyPad );
|
||||||
view->Add( m_axisOrigin );
|
view->Add( m_axisOrigin );
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com
|
* Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com
|
||||||
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -113,6 +113,7 @@ private:
|
||||||
// event handlers:
|
// event handlers:
|
||||||
void OnInitDialog( wxInitDialogEvent& event ) override;
|
void OnInitDialog( wxInitDialogEvent& event ) override;
|
||||||
void OnResize( wxSizeEvent& event );
|
void OnResize( wxSizeEvent& event );
|
||||||
|
void OnCancel( wxCommandEvent& event ) override;
|
||||||
|
|
||||||
void OnPadShapeSelection( wxCommandEvent& event ) override;
|
void OnPadShapeSelection( wxCommandEvent& event ) override;
|
||||||
void OnDrillShapeSelected( wxCommandEvent& event ) override;
|
void OnDrillShapeSelected( wxCommandEvent& event ) override;
|
||||||
|
|
|
@ -633,7 +633,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
|
||||||
|
|
||||||
bSizerDisplayPad->Add( m_panelShowPad, 4, wxRIGHT|wxTOP|wxEXPAND, 5 );
|
bSizerDisplayPad->Add( m_panelShowPad, 4, wxRIGHT|wxTOP|wxEXPAND, 5 );
|
||||||
|
|
||||||
m_panelShowPadGal = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), wxDefaultSize, m_galOptions, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
|
m_panelShowPadGal = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), wxDefaultSize, m_galOptions, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO);
|
||||||
bSizerDisplayPad->Add( m_panelShowPadGal, 4, wxEXPAND|wxRIGHT|wxTOP, 5 );
|
bSizerDisplayPad->Add( m_panelShowPadGal, 4, wxEXPAND|wxRIGHT|wxTOP, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
@ -704,6 +704,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
|
||||||
m_buttonGeometry->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onGeometryTransform ), NULL, this );
|
m_buttonGeometry->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onGeometryTransform ), NULL, this );
|
||||||
m_buttonImport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onImportPrimitives ), NULL, this );
|
m_buttonImport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onImportPrimitives ), NULL, this );
|
||||||
m_panelShowPad->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this );
|
m_panelShowPad->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this );
|
||||||
|
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnCancel ), NULL, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
DIALOG_PAD_PROPERTIES_BASE::~DIALOG_PAD_PROPERTIES_BASE()
|
DIALOG_PAD_PROPERTIES_BASE::~DIALOG_PAD_PROPERTIES_BASE()
|
||||||
|
@ -749,6 +750,7 @@ DIALOG_PAD_PROPERTIES_BASE::~DIALOG_PAD_PROPERTIES_BASE()
|
||||||
m_buttonGeometry->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onGeometryTransform ), NULL, this );
|
m_buttonGeometry->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onGeometryTransform ), NULL, this );
|
||||||
m_buttonImport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onImportPrimitives ), NULL, this );
|
m_buttonImport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onImportPrimitives ), NULL, this );
|
||||||
m_panelShowPad->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this );
|
m_panelShowPad->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this );
|
||||||
|
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnCancel ), NULL, this );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,12 +88,12 @@
|
||||||
<event name="OnSetFocus"></event>
|
<event name="OnSetFocus"></event>
|
||||||
<event name="OnSize"></event>
|
<event name="OnSize"></event>
|
||||||
<event name="OnUpdateUI"></event>
|
<event name="OnUpdateUI"></event>
|
||||||
<object class="wxBoxSizer" expanded="0">
|
<object class="wxBoxSizer" expanded="1">
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="name">m_MainSizer</property>
|
<property name="name">m_MainSizer</property>
|
||||||
<property name="orient">wxVERTICAL</property>
|
<property name="orient">wxVERTICAL</property>
|
||||||
<property name="permission">none</property>
|
<property name="permission">none</property>
|
||||||
<object class="sizeritem" expanded="0">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND</property>
|
<property name="flag">wxEXPAND</property>
|
||||||
<property name="proportion">1</property>
|
<property name="proportion">1</property>
|
||||||
|
@ -10210,7 +10210,7 @@
|
||||||
<property name="center_pane">0</property>
|
<property name="center_pane">0</property>
|
||||||
<property name="class">PCB_DRAW_PANEL_GAL</property>
|
<property name="class">PCB_DRAW_PANEL_GAL</property>
|
||||||
<property name="close_button">1</property>
|
<property name="close_button">1</property>
|
||||||
<property name="construction">m_panelShowPadGal = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), wxDefaultSize, m_galOptions, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );</property>
|
<property name="construction">m_panelShowPadGal = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), wxDefaultSize, m_galOptions, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO);</property>
|
||||||
<property name="context_help"></property>
|
<property name="context_help"></property>
|
||||||
<property name="context_menu">1</property>
|
<property name="context_menu">1</property>
|
||||||
<property name="declaration">PCB_DRAW_PANEL_GAL* m_panelShowPadGal;
KIGFX::GAL_DISPLAY_OPTIONS m_galOptions;</property>
|
<property name="declaration">PCB_DRAW_PANEL_GAL* m_panelShowPadGal;
KIGFX::GAL_DISPLAY_OPTIONS m_galOptions;</property>
|
||||||
|
@ -10379,7 +10379,7 @@
|
||||||
<property name="name">m_sdbSizer</property>
|
<property name="name">m_sdbSizer</property>
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<event name="OnApplyButtonClick"></event>
|
<event name="OnApplyButtonClick"></event>
|
||||||
<event name="OnCancelButtonClick"></event>
|
<event name="OnCancelButtonClick">OnCancel</event>
|
||||||
<event name="OnContextHelpButtonClick"></event>
|
<event name="OnContextHelpButtonClick"></event>
|
||||||
<event name="OnHelpButtonClick"></event>
|
<event name="OnHelpButtonClick"></event>
|
||||||
<event name="OnNoButtonClick"></event>
|
<event name="OnNoButtonClick"></event>
|
||||||
|
|
|
@ -198,6 +198,7 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
|
||||||
virtual void onGeometryTransform( wxCommandEvent& event ) { event.Skip(); }
|
virtual void onGeometryTransform( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void onImportPrimitives( wxCommandEvent& event ) { event.Skip(); }
|
virtual void onImportPrimitives( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void OnPaintShowPanel( wxPaintEvent& event ) { event.Skip(); }
|
virtual void OnPaintShowPanel( wxPaintEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue