Commit c1347bbe authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Pcbnew: fix a crash when aborting a pad move or drag in board editor

parent 7b8b51b2
Loading
Loading
Loading
Loading
+3 −17
Original line number Original line Diff line number Diff line
@@ -69,17 +69,6 @@ files in /mingw/include and library link files in /mingw/lib. You can install
path by setting --prefix=/mingw to configure above to change where "make install"
path by setting --prefix=/mingw to configure above to change where "make install"
puts everything.  We will refer to the --prefix setting as <wxInstallDir> below.
puts everything.  We will refer to the --prefix setting as <wxInstallDir> below.


If you are planning to enable the USE_WX_GRAPHICS_CONTEXT option (see options
section below) on Windows using MinGW/MSYS you must build wxWidgets with the
--enable-graphics_ctx switch added to the build configurations above.
Unfortunately it is not quite that simple because MinGW does not define the
Gdi+ header and link library files.  First you must download the required Gdi+
development files from

<http://www.miscdebris.net/blog/2009/09/17/adding-gdi-headers-to-mingw-to-compile-wxwidgets-with-wxgraphicscontext-support/>

and unzip them where MinGW is installed.

Verify that wx-config is in your path.  Modify your PATH environment variable
Verify that wx-config is in your path.  Modify your PATH environment variable
if need be so you can run wx-config from a command prompt.  You may have to
if need be so you can run wx-config from a command prompt.  You may have to
restart your msys shell, depending on how you modify your PATH.
restart your msys shell, depending on how you modify your PATH.
@@ -210,13 +199,10 @@ These should be set from command line:


 KICAD_MINIZIP ON/OFF
 KICAD_MINIZIP ON/OFF


 USE_WX_ZOOM ON/OFF (OPTIONAL)
   Experimental coordinate translation code using wxDC instead of custom
   Kicad version.

 USE_WX_GRAPHICS_CONTEXT ON/OFF (OPTIONAL)
 USE_WX_GRAPHICS_CONTEXT ON/OFF (OPTIONAL)
   Experimental advanced drawing library code using wxGraphicsContext.  It
   *Experimental* advanced drawing library code using wxGraphicsContext (for tests only).
   requires wxWidgets to be built with the --enable-graphics_ctx switch.
   Under Windows, a very recent version of mingw is needed.
   It requires wxWidgets to be built with the --enable-graphics_ctx switch.
   See building wxWidgets above.
   See building wxWidgets above.


Note: that it is easy to build only a specific binary such as pcbnew alone:
Note: that it is easy to build only a specific binary such as pcbnew alone:
+5 −2
Original line number Original line Diff line number Diff line
@@ -22,7 +22,7 @@ static wxPoint Pad_OldPos;


/* Cancel move pad command.
/* Cancel move pad command.
 */
 */
static void Exit_Move_Pad( EDA_DRAW_PANEL* Panel, wxDC* DC )
static void Abort_Move_Pad( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
{
    D_PAD* pad = s_CurrentSelectedPad;
    D_PAD* pad = s_CurrentSelectedPad;


@@ -62,6 +62,9 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
    BASE_SCREEN* screen = aPanel->GetScreen();
    BASE_SCREEN* screen = aPanel->GetScreen();
    D_PAD*       pad    = s_CurrentSelectedPad;
    D_PAD*       pad    = s_CurrentSelectedPad;


    if( pad == NULL )       // Should not occur
        return;

    if( aErase )
    if( aErase )
        pad->Draw( aPanel, aDC, GR_XOR );
        pad->Draw( aPanel, aDC, GR_XOR );


@@ -277,7 +280,7 @@ void WinEDA_BasePcbFrame::StartMovePad( D_PAD* Pad, wxDC* DC )
    s_CurrentSelectedPad = Pad;
    s_CurrentSelectedPad = Pad;
    Pad_OldPos = Pad->m_Pos;
    Pad_OldPos = Pad->m_Pos;
    Pad->DisplayInfo( this );
    Pad->DisplayInfo( this );
    DrawPanel->SetMouseCapture( Show_Pad_Move, Exit_Move_Pad );
    DrawPanel->SetMouseCapture( Show_Pad_Move, Abort_Move_Pad );


    /* Draw the pad  (SKETCH mode) */
    /* Draw the pad  (SKETCH mode) */
    Pad->Draw( DrawPanel, DC, GR_XOR );
    Pad->Draw( DrawPanel, DC, GR_XOR );