c++ - Exe binary crashes only outside IDE -
an opencv1.0 project uses cvblob structure lot (functions parameters, lists of blobs, etc).
struct cvblob{ float x,y,w,h; int id; } i added members success inside vc9 project, until found out binary couldn't run outside ide in release mode. crashes during destruction somewhere (it doesn't when executed inside project).
the new structure:
struct cvblob{ float x,y,w,h; int id,myint; //works fine. double* mydouble; //crushes outside visual studio. } during rutime, mydouble used array:
blob.mydouble=new double [10]; any generic advise, before dive large source code?
edit: debug runs outside ide.
edit2: cvseq used main blob list container: cvseqpush(cvseq*,cvblob*), cvseqremove(cvseq*,int). undefined behavior here?
shouldn't able extend cvblob structure , add own constructor , destructor manage memory mydouble?
struct mycvblob : cvblob { double* mydouble; // initialize mydouble null in constructor mycvblob() { mydouble = null; } // free memory pointed mydouble if in use virtual ~mycvblob() { if(mydouble) { delete [] mydouble; } } }; mycvblob blob; blob.mydouble = new double[10];
Comments
Post a Comment