On 11/08/2010 17:37, Noel O'Boyle wrote: > Hi all, > > I am trying to track down a segfault on a SMI to CML conversion which > fails in the destructor of ~OBConversion at "delete pLineEndBuf". > > I am wondering whether this is related to the following in the copy > constructor OBConversion::OBConversion(const OBConversion& o): > > pLineEndBuf = o.pLineEndBuf; > > "p" indicates a pointer and I think that (in this case) it's either > NULL or else pointing to an object allocated with "new". Would I be > right in saying that the object pointed to by o.pLineEndBuf could be > destructed at any moment, and the right thing to do in the copy > constructor is to call "new" again for a new object? Something like... > > pLineEndBuf = NULL; > if (o.pLineEndBuf) > pLineEndBuf = new LErdbuf(*pLineEndBuf); > > Anyway, maybe someone could think about this. > > - Noel > > ------------------------------------------------------------------------------ >
Hi, Isn't this something that smart pointers are supposed to help with? At least then there may be a destructor we can put a breakpoint in. Alex ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel