From 42ee4f79e46bc980520eda836d4fe7e9b1397a26 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 12 Sep 2018 20:39:37 +0100 Subject: [PATCH] Fix assert in Graphic Item Properties. Fixes: lp:1792201 * https://bugs.launchpad.net/kicad/+bug/1792201 --- .../dialog_graphic_item_properties.cpp | 29 ++++--------------- pcbnew/edit.cpp | 2 +- pcbnew/footprint_editor_onclick.cpp | 2 +- pcbnew/footprint_editor_utils.cpp | 2 +- pcbnew/onleftclick.cpp | 2 +- pcbnew/pcb_base_edit_frame.h | 2 +- 6 files changed, 10 insertions(+), 29 deletions(-) diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index 83352c3e3c..25a21efbbe 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -46,7 +46,6 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES : public DIALOG_GRAPHIC_ITEM_PROPERTIES_BAS { private: PCB_BASE_EDIT_FRAME* m_parent; - wxDC* m_DC; DRAWSEGMENT* m_item; EDGE_MODULE* m_moduleItem; @@ -61,7 +60,7 @@ private: double m_AngleValue; public: - DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem, wxDC* aDC ); + DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem ); ~DIALOG_GRAPHIC_ITEM_PROPERTIES() {}; private: @@ -81,7 +80,7 @@ private: }; DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, - BOARD_ITEM* aItem, wxDC* aDC ): + BOARD_ITEM* aItem ): DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( aParent ), m_startX( aParent, m_startXLabel, m_startXCtrl, m_startXUnits ), m_startY( aParent, m_startYLabel, m_startYCtrl, m_startYUnits ), @@ -97,7 +96,6 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR m_AngleValue( 0.0 ) { m_parent = aParent; - m_DC = aDC; m_item = dynamic_cast( aItem ); m_moduleItem = dynamic_cast( aItem ); @@ -120,23 +118,16 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR } -void PCB_BASE_EDIT_FRAME::InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem, wxDC* aDC ) +void PCB_BASE_EDIT_FRAME::InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem ) { wxCHECK_RET( aItem != NULL, wxT( "InstallGraphicItemPropertiesDialog() error: NULL item" ) ); -#ifdef USE_WX_OVERLAY - // #1277772 - Draw into dialog converted in refresh request - aDC = nullptr; -#endif - m_canvas->SetIgnoreMouseEvents( true ); - DIALOG_GRAPHIC_ITEM_PROPERTIES dlg( this, aItem, aDC ); + DIALOG_GRAPHIC_ITEM_PROPERTIES dlg( this, aItem ); dlg.ShowModal(); m_canvas->MoveCursorToCrossHair(); m_canvas->SetIgnoreMouseEvents( false ); - - if( !aDC ) - m_canvas->Refresh(); + m_canvas->Refresh(); } @@ -234,11 +225,6 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow() BOARD_COMMIT commit( m_parent ); commit.Modify( m_item ); - wxString msg; - - if( m_DC ) - m_item->Draw( m_parent->GetCanvas(), m_DC, GR_XOR ); - m_item->SetStartX( m_startX.GetValue() ); m_item->SetStartY( m_startY.GetValue() ); @@ -277,17 +263,12 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow() m_item->SetLayer( ToLAYER_ID( layer ) ); if( m_item->GetShape() == S_ARC ) - { m_item->SetAngle( m_AngleValue * 10.0 ); - } m_item->RebuildBezierToSegmentsPointsList( m_item->GetWidth() ); commit.Push( _( "Modify drawing properties" ) ); - if( m_DC ) - m_item->Draw( m_parent->GetCanvas(), m_DC, GR_OR ); - m_parent->SetMsgPanel( m_item ); return true; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index c59db64fa1..ae5622a3b5 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1119,7 +1119,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_EDIT_DRAWING: - InstallGraphicItemPropertiesDialog( GetCurItem(), &dc ); + InstallGraphicItemPropertiesDialog( GetCurItem() ); break; case ID_POPUP_PCB_MOVE_DRAWING_REQUEST: diff --git a/pcbnew/footprint_editor_onclick.cpp b/pcbnew/footprint_editor_onclick.cpp index d55db5081d..d4d836fcce 100644 --- a/pcbnew/footprint_editor_onclick.cpp +++ b/pcbnew/footprint_editor_onclick.cpp @@ -534,7 +534,7 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ) break; case PCB_MODULE_EDGE_T : - InstallGraphicItemPropertiesDialog( aItem, nullptr ); + InstallGraphicItemPropertiesDialog( aItem ); break; default: diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index 014561b3cf..11d27bf016 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -714,7 +714,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_MODEDIT_EDIT_BODY_ITEM : - InstallGraphicItemPropertiesDialog( GetScreen()->GetCurItem(), nullptr ); + InstallGraphicItemPropertiesDialog( GetScreen()->GetCurItem() ); break; case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE: diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp index 799be3a675..12e3524eb8 100644 --- a/pcbnew/onleftclick.cpp +++ b/pcbnew/onleftclick.cpp @@ -608,7 +608,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ) break; case PCB_LINE_T: - InstallGraphicItemPropertiesDialog( aItem, aDC ); + InstallGraphicItemPropertiesDialog( aItem ); break; case PCB_ZONE_AREA_T: diff --git a/pcbnew/pcb_base_edit_frame.h b/pcbnew/pcb_base_edit_frame.h index a564cd368a..2705c8bbca 100644 --- a/pcbnew/pcb_base_edit_frame.h +++ b/pcbnew/pcb_base_edit_frame.h @@ -164,7 +164,7 @@ public: void SetRotationAngle( int aRotationAngle ); void InstallTextOptionsFrame( BOARD_ITEM* aText, wxDC* aDC ); - void InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem, wxDC* aDC ); + void InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem ); ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas() void UseGalCanvas( bool aEnable ) override;