← Back to team overview

kicad-developers team mailing list archive

PATCH: fix double-free bug in 3D model viewer

 

The attached patch fixes bug #1572567 (crash on exit from
3D Footprint Properties dialog). Since there was no check
before deleting m_ogl_3dmode, delete can be called on
NULL.

- Cirilo
=== modified file '3d-viewer/3d_model_viewer/c3d_model_viewer.cpp'
--- 3d-viewer/3d_model_viewer/c3d_model_viewer.cpp	2016-04-07 01:41:52 +0000
+++ 3d-viewer/3d_model_viewer/c3d_model_viewer.cpp	2016-05-23 21:28:30 +0000
@@ -102,11 +102,10 @@
 {
     wxLogTrace( m_logTrace, wxT( "C3D_MODEL_VIEWER::~C3D_MODEL_VIEWER" ) );
 
-    delete m_ogl_3dmodel;
-    m_ogl_3dmodel = NULL;
+    if( m_ogl_3dmodel )
+        delete m_ogl_3dmodel;
 
     delete m_glRC;
-    m_glRC = NULL;
 }
 
 


Follow ups