J
Jamie Burns
Hello,
I have a function which uses an object I made. The object simply parses a
text file and provides access to some of the data.
I am trying to use it in a method of a different object.
The problem is, when I declare it like this:
{
Properties properties("/tmp/data.properties");
// use object...
}
It causes a SEGFAULT when its destructor is called every time.
But if I do:
{
auto_ptr<Properties> properties(new Properties("/tmp/data.properties"));
// use object...
}
Then it destructs perfectly every time.
Is there an issue declaring things on the stack vs heap?
Why does this happen?
Jamie.
I have a function which uses an object I made. The object simply parses a
text file and provides access to some of the data.
I am trying to use it in a method of a different object.
The problem is, when I declare it like this:
{
Properties properties("/tmp/data.properties");
// use object...
}
It causes a SEGFAULT when its destructor is called every time.
But if I do:
{
auto_ptr<Properties> properties(new Properties("/tmp/data.properties"));
// use object...
}
Then it destructs perfectly every time.
Is there an issue declaring things on the stack vs heap?
Why does this happen?
Jamie.