Browse Source

Fix crash when removing surface after releasing mouse outside window

master
Krisjanis Rijnieks 11 years ago
parent
commit
e307d6c62a
  1. 5
      src/ofxBaseSurface.cpp
  2. 1
      src/ofxBaseSurface.h
  3. 12
      src/ofxProjectionEditor.cpp

5
src/ofxBaseSurface.cpp

@ -64,4 +64,9 @@ void ofxBaseSurface::setTexture(ofTexture *texturePtr)
ofTexture* ofxBaseSurface::getTexture()
{
return texture;
}
ofTexture* ofxBaseSurface::getDefaultTexture()
{
return &defaultTexture;
}

1
src/ofxBaseSurface.h

@ -26,6 +26,7 @@ public:
void setTexture(ofTexture* texturePtr);
ofTexture* getTexture();
ofTexture* getDefaultTexture();
protected:
ofMesh mesh;

12
src/ofxProjectionEditor.cpp

@ -68,8 +68,16 @@ void ofxProjectionEditor::update(ofEventArgs &args)
// update surface if one of the joints is being dragged
for ( int i=0; i<joints.size(); i++ ) {
if ( joints[i]->isDragged() || joints[i]->isSelected() ) {
// update vertex to new location
surfaceManager->getSelectedSurface()->setVertex(i, joints[i]->position);
if ( surfaceManager->getSelectedSurface() != NULL ) {
// update vertex to new location
surfaceManager->getSelectedSurface()->setVertex(i, joints[i]->position);
} else {
// clear joints if there is no surface selected
// as the remove selected surface in the surface manager
// is not supposed to access joints here
joints.clear();
}
break;
}
}

Loading…
Cancel
Save