kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #06130
[PATCH] PCBNEW crashes when enter 3d view
Hello,
After my investigation of the 3d view bug which affected some computer,
below is the patch. You may read the previous post on this topic for more
information.
This is my first time trying to make a patch, so please bear with me :)
=== modified file '3d-viewer/3d_canvas.cpp'
--- 3d-viewer/3d_canvas.cpp 2011-01-20 16:34:57 +0000
+++ 3d-viewer/3d_canvas.cpp 2011-01-29 04:39:05 +0000
@@ -73,9 +73,9 @@
Pcb3D_GLCanvas::OnPopUpMenu )
END_EVENT_TABLE()
-Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent ) :
-#if wxCHECK_VERSION( 2, 9, 0 )
- wxGLCanvas( parent, -1, NULL, wxDefaultPosition, wxDefaultSize,
+Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent, int* attribList
) :
+#if wxCHECK_VERSION( 2, 7, 0 )
+ wxGLCanvas( parent, -1, attribList, wxDefaultPosition, wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE )
#else
wxGLCanvas( parent, -1, wxDefaultPosition, wxDefaultSize,
@@ -87,7 +87,7 @@
m_Parent = parent;
m_ortho = false;
-#if wxCHECK_VERSION( 2, 9, 0 )
+#if wxCHECK_VERSION( 2, 7, 0 )
// Explicitly create a new rendering context instance for this canvas.
m_glRC = new wxGLContext( this );
@@ -101,7 +101,7 @@
{
ClearLists();
m_init = FALSE;
-#if wxCHECK_VERSION( 2, 9, 0 )
+#if wxCHECK_VERSION( 2, 7, 0 )
delete m_glRC;
#endif
}
=== modified file '3d-viewer/3d_draw.cpp'
--- 3d-viewer/3d_draw.cpp 2011-01-19 10:34:56 +0000
+++ 3d-viewer/3d_draw.cpp 2011-01-29 04:46:23 +0000
@@ -55,7 +55,11 @@
void Pcb3D_GLCanvas::Redraw( bool finish )
{
-#if wxCHECK_VERSION( 2, 9, 0 )
+ /* SwapBuffer requires the window to be shown before calling */
+ if( !IsShown() )
+ return;
+
+#if wxCHECK_VERSION( 2, 7, 0 )
SetCurrent( *m_glRC );
#else
SetCurrent();
@@ -96,8 +100,9 @@
}
glFlush();
- if( finish )
+ if( finish );
glFinish();
+
SwapBuffers();
}
=== modified file '3d-viewer/3d_frame.cpp'
--- 3d-viewer/3d_frame.cpp 2010-10-04 12:58:07 +0000
+++ 3d-viewer/3d_frame.cpp 2011-01-29 04:43:39 +0000
@@ -78,7 +78,8 @@
ReCreateVToolbar();
// Make a Pcb3D_GLCanvas
- m_Canvas = new Pcb3D_GLCanvas( this );
+ int attrs[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16,
0};
+ m_Canvas = new Pcb3D_GLCanvas( this, attrs );
m_auimgr.SetManagedWindow( this );
=== modified file '3d-viewer/3d_viewer.h'
--- 3d-viewer/3d_viewer.h 2010-12-29 17:47:32 +0000
+++ 3d-viewer/3d_viewer.h 2011-01-29 04:38:32 +0000
@@ -141,11 +141,11 @@
/// Tracks whether to use Orthographic or Perspective projection
//TODO: Does this belong here, or in WinEDA3D_DrawFrame ???
bool m_ortho;
-#if wxCHECK_VERSION( 2, 9, 0 )
+#if wxCHECK_VERSION( 2, 7, 0 )
wxGLContext* m_glRC;
#endif
public:
- Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent );
+ Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent, int* attribList = 0 );
~Pcb3D_GLCanvas();
void ClearLists();