On Aug 28, 1:48 pm, Joe Greer <jgr...@doubletake.com> wrote:
> Goran <postmasch...@gmail.com> wrote in news:1188264416.738284.208330
> @y42g2000hsy.googlegroups.com:
>
>
>
> > Hi all,
>
> > i have a problem on program termination.
>
> > At the moment when main() ends my program creates a segmentation
> > fault.
>
> > #include <libmylib/myObject.h>
>
> > int main() {
>
> > using namespace Mylib;
>
> > MyObject1_t * aObject1 = 0;
> > MyObject2_t aObject2("someString");
>
> > aObject1 = new Object1_t(aObject2);
>
> > delete aObject1; // program still works
>
> > // cout or other still works here
>
> > return(0); // program creates an seg. fault
>
> > }
>
> See Victor's posting about crystal balls etc, but if I had to guess...
>
> aObject2 is the only variable on the stack and I would guess that it's
> destruction at the return is what's causing the fault. Since you pass
> in a literal text string, I further guess that aObject2 has grabbed that
> pointer and you are trying to delete it when aObject2 is destroyed.
>
> Can't say much more than that with out actual code.
>
> joe
Thanks to all! I've found the prob. My object used pointers for member
var. and I had NO copy constructor... Still learning :)
Goran