From 7ff233990bf63842b164caf4a45aed9ee7a52ef8 Mon Sep 17 00:00:00 2001 From: Guido Ranzuglia granzuglia Date: Fri, 16 Mar 2012 17:46:58 +0000 Subject: [PATCH] removed crash on closing window with an active shader. Temporary patch! --- src/meshlab/glarea.cpp | 3 ++- src/meshlab/glarea.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/meshlab/glarea.cpp b/src/meshlab/glarea.cpp index b54c899e4..51a310cb3 100644 --- a/src/meshlab/glarea.cpp +++ b/src/meshlab/glarea.cpp @@ -106,7 +106,8 @@ GLArea::GLArea(MultiViewer_Container *mvcont, RichParameterSet *current) GLArea::~GLArea() { // warn any iRender plugin that we're deleting glarea - if (iRenderer) + MeshDocument* md = this->md(); + if (iRenderer && (md != NULL)) iRenderer->Finalize(currentShader, *this->md(), this); if(targetTex) glDeleteTextures(1, &targetTex); } diff --git a/src/meshlab/glarea.h b/src/meshlab/glarea.h index 4c73fa9ff..67e37cde5 100644 --- a/src/meshlab/glarea.h +++ b/src/meshlab/glarea.h @@ -91,8 +91,8 @@ public: MultiViewer_Container *mvc(); MainWindow *mw(); - MeshModel *mm(){ return mvc()->meshDoc.mm();} - inline MeshDocument *md() {return &(mvc()->meshDoc);} + MeshModel *mm(){ if (mvc() == NULL) return NULL;return mvc()->meshDoc.mm();} + inline MeshDocument *md() {if (mvc() == NULL) return NULL;return &(mvc()->meshDoc);} vcg::Trackball trackball; vcg::Trackball trackball_light;