Commit c4edb215 authored by charras's avatar charras

Try to fix some issues (OSX crashes and build and seg fault under linux)

parent 4c001cd4
...@@ -63,18 +63,26 @@ END_EVENT_TABLE() ...@@ -63,18 +63,26 @@ END_EVENT_TABLE()
/*************************************************************************/ /*************************************************************************/
Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent ) : Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent ) :
#if wxCHECK_VERSION( 2, 9, 0 )
wxGLCanvas( parent, -1, NULL, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE ) wxGLCanvas( parent, -1, NULL, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE )
#else
wxGLCanvas( parent, -1, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE )
#endif
/*************************************************************************/ /*************************************************************************/
{ {
m_init = FALSE; m_init = FALSE;
m_gllist = 0; m_gllist = 0;
m_Parent = parent; m_Parent = parent;
#if wxCHECK_VERSION( 2, 9, 0 )
// Explicitly create a new rendering context instance for this canvas. // Explicitly create a new rendering context instance for this canvas.
m_glRC = new wxGLContext(this); m_glRC = new wxGLContext(this);
// Make the new context current (activate it for use) with this canvas. // Make the new context current (activate it for use) with this canvas.
SetCurrent(*m_glRC); SetCurrent(*m_glRC);
#else
SetCurrent(NULL);
#endif
DisplayStatus(); DisplayStatus();
} }
...@@ -85,7 +93,9 @@ Pcb3D_GLCanvas::~Pcb3D_GLCanvas() ...@@ -85,7 +93,9 @@ Pcb3D_GLCanvas::~Pcb3D_GLCanvas()
{ {
ClearLists(); ClearLists();
m_init = FALSE; m_init = FALSE;
#if wxCHECK_VERSION( 2, 9, 0 )
delete m_glRC; delete m_glRC;
#endif
} }
......
...@@ -46,7 +46,11 @@ static GLfloat Get3DLayerSide( int act_layer ); ...@@ -46,7 +46,11 @@ static GLfloat Get3DLayerSide( int act_layer );
void Pcb3D_GLCanvas::Redraw( bool finish ) void Pcb3D_GLCanvas::Redraw( bool finish )
/******************************************/ /******************************************/
{ {
#if wxCHECK_VERSION( 2, 9, 0 )
SetCurrent(*m_glRC); SetCurrent(*m_glRC);
#else
SetCurrent(NULL);
#endif
InitGL(); InitGL();
glMatrixMode( GL_MODELVIEW ); /* position viewer */ glMatrixMode( GL_MODELVIEW ); /* position viewer */
......
...@@ -79,7 +79,9 @@ public: ...@@ -79,7 +79,9 @@ public:
private: private:
bool m_init; bool m_init;
GLuint m_gllist; GLuint m_gllist;
#if wxCHECK_VERSION( 2, 9, 0 )
wxGLContext* m_glRC; wxGLContext* m_glRC;
#endif
public: public:
Pcb3D_GLCanvas( WinEDA3D_DrawFrame *parent ); Pcb3D_GLCanvas( WinEDA3D_DrawFrame *parent );
......
...@@ -119,13 +119,14 @@ NETLIST_OBJECT::NETLIST_OBJECT() ...@@ -119,13 +119,14 @@ NETLIST_OBJECT::NETLIST_OBJECT()
m_Label = 0; /* For all labels:pointer on the text label */ m_Label = 0; /* For all labels:pointer on the text label */
} }
// Copy constructor // Copy constructor
NETLIST_OBJECT::NETLIST_OBJECT( NETLIST_OBJECT& aSource ) NETLIST_OBJECT::NETLIST_OBJECT( NETLIST_OBJECT& aSource )
{ {
*this = aSource;
m_Label = NULL; // set to null because some items are owner, so the delete operator can create problems
// if this member is copied here (if 2 different items are owner of the same object)
} }
NETLIST_OBJECT::~NETLIST_OBJECT() NETLIST_OBJECT::~NETLIST_OBJECT()
{ {
/* NETLIST_OBJECT is owner of m_Label only if its type is /* NETLIST_OBJECT is owner of m_Label only if its type is
......
...@@ -740,7 +740,6 @@ static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer, ...@@ -740,7 +740,6 @@ static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
{ {
NETLIST_OBJECT* new_label = new NETLIST_OBJECT( BusLabel ); NETLIST_OBJECT* new_label = new NETLIST_OBJECT( BusLabel );
NumItem++; NumItem++;
/* Convertion du BusLabel en la racine du Label + le numero du fil */ /* Convertion du BusLabel en la racine du Label + le numero du fil */
BufLine = BusLabel.m_Label->Left( RootBusNameLength ); BufLine = BusLabel.m_Label->Left( RootBusNameLength );
BufLine << BusMember; BufLine << BusMember;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment