From c4edb215fa8dde02aad1138935afd00127925d36 Mon Sep 17 00:00:00 2001 From: charras Date: Mon, 20 Jul 2009 13:44:41 +0000 Subject: [PATCH] Try to fix some issues (OSX crashes and build and seg fault under linux) --- 3d-viewer/3d_canvas.cpp | 10 ++++++++++ 3d-viewer/3d_draw.cpp | 4 ++++ 3d-viewer/3d_viewer.h | 2 ++ eeschema/class_netlist_object.cpp | 5 +++-- eeschema/netlist.cpp | 1 - 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/3d-viewer/3d_canvas.cpp b/3d-viewer/3d_canvas.cpp index 0fc0f0c84d..3fc766646f 100644 --- a/3d-viewer/3d_canvas.cpp +++ b/3d-viewer/3d_canvas.cpp @@ -63,18 +63,26 @@ END_EVENT_TABLE() /*************************************************************************/ Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent ) : +#if wxCHECK_VERSION( 2, 9, 0 ) 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_gllist = 0; m_Parent = parent; +#if wxCHECK_VERSION( 2, 9, 0 ) // Explicitly create a new rendering context instance for this canvas. m_glRC = new wxGLContext(this); // Make the new context current (activate it for use) with this canvas. SetCurrent(*m_glRC); +#else + SetCurrent(NULL); +#endif DisplayStatus(); } @@ -85,7 +93,9 @@ Pcb3D_GLCanvas::~Pcb3D_GLCanvas() { ClearLists(); m_init = FALSE; +#if wxCHECK_VERSION( 2, 9, 0 ) delete m_glRC; +#endif } diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index f94ee97df6..29becb7741 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -46,7 +46,11 @@ static GLfloat Get3DLayerSide( int act_layer ); void Pcb3D_GLCanvas::Redraw( bool finish ) /******************************************/ { +#if wxCHECK_VERSION( 2, 9, 0 ) SetCurrent(*m_glRC); +#else + SetCurrent(NULL); +#endif InitGL(); glMatrixMode( GL_MODELVIEW ); /* position viewer */ diff --git a/3d-viewer/3d_viewer.h b/3d-viewer/3d_viewer.h index 7aa0f9792a..14be22c88b 100644 --- a/3d-viewer/3d_viewer.h +++ b/3d-viewer/3d_viewer.h @@ -79,7 +79,9 @@ public: private: bool m_init; GLuint m_gllist; +#if wxCHECK_VERSION( 2, 9, 0 ) wxGLContext* m_glRC; +#endif public: Pcb3D_GLCanvas( WinEDA3D_DrawFrame *parent ); diff --git a/eeschema/class_netlist_object.cpp b/eeschema/class_netlist_object.cpp index 41c1012adb..5156333106 100644 --- a/eeschema/class_netlist_object.cpp +++ b/eeschema/class_netlist_object.cpp @@ -119,13 +119,14 @@ NETLIST_OBJECT::NETLIST_OBJECT() m_Label = 0; /* For all labels:pointer on the text label */ } - // Copy constructor 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 is owner of m_Label only if its type is diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp index b5be01400d..495b6e3e3c 100644 --- a/eeschema/netlist.cpp +++ b/eeschema/netlist.cpp @@ -740,7 +740,6 @@ static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer, { NETLIST_OBJECT* new_label = new NETLIST_OBJECT( BusLabel ); NumItem++; - /* Convertion du BusLabel en la racine du Label + le numero du fil */ BufLine = BusLabel.m_Label->Left( RootBusNameLength ); BufLine << BusMember;