Skip to content

Commit

Permalink
Don't call destroy() in destructor unless we're a body.
Browse files Browse the repository at this point in the history
  • Loading branch information
totalgee committed Feb 28, 2014
1 parent a8fa92f commit 2005f17
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ofxBox2dBaseShape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ ofxBox2dBaseShape::ofxBox2dBaseShape() {

//----------------------------------------
ofxBox2dBaseShape::~ofxBox2dBaseShape() {
ofLog(OF_LOG_VERBOSE, "~ofxBox2dBaseShape(%p)\n", body);
destroy();
ofLog(OF_LOG_VERBOSE, "~ofxBox2dBaseShape(%p)\n", body);
if (isBody()) {
destroy();
}
}

//------------------------------------------------
Expand Down Expand Up @@ -57,7 +59,8 @@ bool ofxBox2dBaseShape::shouldRemoveOffScreen(ofPtr<ofxBox2dBaseShape> shape) {
bool ofxBox2dBaseShape::isBody() {
if (body == NULL) {
//cout << __FILE__ << __func__ << endl;
ofLog(OF_LOG_ERROR, "ofxBox2dBaseShape:: - body is not defined -");
// Why do we have to log something if we're not a body, when the
// whole point of this method is just to query whether we are...?
return false;
}
return true;
Expand Down

0 comments on commit 2005f17

Please sign in to comment.