ofxThreadedVideo icon indicating copy to clipboard operation
ofxThreadedVideo copied to clipboard

ofxThreadedVideoNullCommand instantiated?

Open borg opened this issue 11 years ago • 0 comments

Are you sure ofxThreadedVideoNullCommand is instantiated? It is declared in ofxThreadedVideo.h but I think static variables need to be instantiated in the body file, no? They are a bit odd I think. Not sure why its a global static and not a class variable, but making following change seems to have fixed the issue with null ofxThreadedVideoNullCommand. Have yet to test thoroughly.

static ofxThreadedVideoCommand ofxThreadedVideoNullCommand;

Got a crash on line

ofxThreadedVideoCommand ofxThreadedVideo::getCommand(){
>>> return ofxThreadedVideoNullCommand;

Turned it into a class static variable

class ofxThreadedVideo : public ofThread {

public:
    static ofxThreadedVideoCommand ofxThreadedVideoNullCommand;
}
#include "ofxThreadedVideo.h"
ofxThreadedVideoCommand ofxThreadedVideo::ofxThreadedVideoNullCommand;


ofxThreadedVideoCommand ofxThreadedVideo::getCommand(){
    if(ofxThreadedVideoCommands.size() > 0){
        return ofxThreadedVideoCommands.front();
    }else{
        return ofxThreadedVideo::ofxThreadedVideoNullCommand;
    }
}

borg avatar Jul 24 '14 17:07 borg