From bd80073e5710825a320bca01b35cd23ebe2db93c Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Fri, 2 Nov 2007 13:58:28 +0000 Subject: [PATCH] fixed a crash with the release version --- src/meshlabplugins/editsegment/editsegment.cpp | 17 +++++++++++++---- src/meshlabplugins/editsegment/editsegment.h | 1 - src/meshlabplugins/editsegment/editsegment.pro | 8 +++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/meshlabplugins/editsegment/editsegment.cpp b/src/meshlabplugins/editsegment/editsegment.cpp index 1ffb6c94d..b8349e509 100644 --- a/src/meshlabplugins/editsegment/editsegment.cpp +++ b/src/meshlabplugins/editsegment/editsegment.cpp @@ -227,15 +227,20 @@ Color4b toVcgColor(QColor c) { return Color4b(c.red(),c.green(),c.blue(),255); } EditSegment::EditSegment() { - actionList << new QAction(QIcon(":/images/editsegment.png"),"Mesh Segmentation", this); + QAction* qaction = new QAction(QIcon(":/images/editsegment.png"),"Mesh Segmentation", this); + qaction->setCheckable(true); + actionList << qaction; pixels = 0; pen.radius = 3; pen.backface = false; pen.invisible = false; pressed = false; + dragging = false; + first = true; meshCut = 0; meshCutDialog = 0; - glarea = 0; + meshcut_dock = 0; + //glarea = 0; selectForeground = true; } EditSegment::~EditSegment(){ @@ -290,6 +295,10 @@ void EditSegment::StartEdit(QAction * mode, MeshModel & m, GLArea * parent) { parent->getCurrentRenderMode().colorMode=vcg::GLW::CMPerVert; parent->mm()->ioMask|=MeshModel::IOM_VERTCOLOR; + first = true; + pressed = false; + dragging = false; + glarea = parent; parent->update(); @@ -304,7 +313,7 @@ void EditSegment::Decorate (QAction * ac, MeshModel & m, GLArea * gla) { if (first) { first=false; - if (pixels!=0) { free(pixels); } + if (pixels) { free(pixels); } pixels=(GLfloat *)malloc(sizeof(GLfloat)*gla->curSiz.width()*gla->curSiz.height()); glReadPixels(0,0,gla->curSiz.width(),gla->curSiz.height(),GL_DEPTH_COMPONENT,GL_FLOAT,pixels); } @@ -318,8 +327,8 @@ void EditSegment::Decorate (QAction * ac, MeshModel & m, GLArea * gla) { vector faceSel; getInternFaces(m,¤tSelection,&newSel,&faceSel,gla,pen,current_point,previous_point,pixels,mvmatrix,projmatrix,viewport); - vector::iterator fpo; + vector::iterator fpo; for(fpo=faceSel.begin();fpo!=faceSel.end();++fpo) { for (int i=0; i<3; ++i) { if (mouse_button_pressed==Qt::LeftButton) { diff --git a/src/meshlabplugins/editsegment/editsegment.h b/src/meshlabplugins/editsegment/editsegment.h index 58ab79e8c..06a09d5a2 100644 --- a/src/meshlabplugins/editsegment/editsegment.h +++ b/src/meshlabplugins/editsegment/editsegment.h @@ -36,7 +36,6 @@ private: bool first; bool dragging; bool selectForeground; - QPoint starting_point; QPoint current_point; QPoint previous_point; Qt::MouseButton mouse_button_pressed; diff --git a/src/meshlabplugins/editsegment/editsegment.pro b/src/meshlabplugins/editsegment/editsegment.pro index 0bbd6d030..7ae9b80db 100644 --- a/src/meshlabplugins/editsegment/editsegment.pro +++ b/src/meshlabplugins/editsegment/editsegment.pro @@ -1,5 +1,6 @@ TEMPLATE = lib CONFIG += plugin +CONFIG += debug_and_release INCLUDEPATH += ../.. ../../../../sf ../../../../code/lib/glew/include HEADERS = editsegment.h cutting.h curvaturetensor.h meshcutdialog.h colorpicker.h SOURCES = editsegment.cpp ../../../../code/lib/glew/src/glew.c meshcutdialog.cpp colorpiker.cpp @@ -9,6 +10,7 @@ DEFINES += GLEW_STATIC QT += opengl RESOURCES = meshlab.qrc FORMS+=meshcutdialog.ui + contains(TEMPLATE,lib){ CONFIG(debug, debug|release){ unix{ @@ -19,6 +21,6 @@ contains(TEMPLATE,lib){ } } } -#win32{ -# DEFINES += NOMINMAX -#} +win32{ + DEFINES += NOMINMAX +}