Fixed segfault which occured when open ing the module editor, loading a module, closing it, and opening the module editor again. This was
caused by prematurely deleting the module editor's m_Pcb pointer, which has the same value (points to the same structure) as g_ModuleEditor_Pcb hence should not be deleted.
This commit is contained in:
parent
fb54ab8649
commit
6d609d1837
|
@ -21,7 +21,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifndef SAFE_DELETE
|
#ifndef SAFE_DELETE
|
||||||
#define SAFE_DELETE(p) delete (p); (p) = NULL;
|
#define SAFE_DELETE(p) delete (p); (p) = NULL; //C++ guarantees that operator delete checks its argument for null-ness
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define INTERNAL_UNIT_TYPE 0 // Internal unit = inch
|
#define INTERNAL_UNIT_TYPE 0 // Internal unit = inch
|
||||||
|
|
|
@ -68,7 +68,8 @@ WinEDA_BasePcbFrame::~WinEDA_BasePcbFrame( void )
|
||||||
|
|
||||||
void WinEDA_BasePcbFrame::SetBOARD( BOARD* aBoard )
|
void WinEDA_BasePcbFrame::SetBOARD( BOARD* aBoard )
|
||||||
{
|
{
|
||||||
delete m_Pcb;
|
if(m_Pcb != g_ModuleEditor_Pcb)
|
||||||
|
delete m_Pcb;
|
||||||
m_Pcb = aBoard;
|
m_Pcb = aBoard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -382,7 +382,7 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base,
|
||||||
if( PtSegmN == PtRefSegm )
|
if( PtSegmN == PtRefSegm )
|
||||||
goto suite;
|
goto suite;
|
||||||
|
|
||||||
/* max_dist is the max distance between 2 tack ends which ensure a copper continuty */
|
/* max_dist is the max distance between 2 track ends which ensure a copper continuty */
|
||||||
max_dist = (PtSegmN->m_Width + PtRefSegm->m_Width)/2;
|
max_dist = (PtSegmN->m_Width + PtRefSegm->m_Width)/2;
|
||||||
|
|
||||||
if( IsPointsAreNear(pos_ref, PtSegmN->m_Start, max_dist) )
|
if( IsPointsAreNear(pos_ref, PtSegmN->m_Start, max_dist) )
|
||||||
|
|
|
@ -136,7 +136,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* pa
|
||||||
|
|
||||||
m_Pcb->m_PcbFrame = this;
|
m_Pcb->m_PcbFrame = this;
|
||||||
m_CurrentScreen = ScreenModule;
|
m_CurrentScreen = ScreenModule;
|
||||||
SetCurItem( NULL );
|
m_CurrentScreen->SetCurItem( NULL );
|
||||||
GetSettings();
|
GetSettings();
|
||||||
|
|
||||||
wxSize GridSize( 500, 500 );
|
wxSize GridSize( 500, 500 );
|
||||||
|
|
|
@ -250,7 +250,7 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame()
|
||||||
m_Parent->m_PcbFrame = NULL;
|
m_Parent->m_PcbFrame = NULL;
|
||||||
m_CurrentScreen = ScreenPcb;
|
m_CurrentScreen = ScreenPcb;
|
||||||
delete m_drc;
|
delete m_drc;
|
||||||
delete m_Pcb;
|
if(m_Pcb != g_ModuleEditor_Pcb) delete m_Pcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue