+2  A: 

It's likely to be a problem with Object. What happens if you change Object to int?

DanDan
It's still buggy if I change Object to int!
Kensou
+3  A: 

I don't know if this helps your specific problem, but it is sometimes desirable to use make_shared and avoid the new.

so:

return boost::make_shared<Object>(/* any arguments to constructor here */);

Additionally, you could try std::shared_ptr instead of boost::shared_ptr. They're probably exactly the same, but maybe not? To use it via TR1, I believe you #include <tr1/memory>. I usually just use it via C++0x, in which case it's #include <memory> and add -std=c++0x to your g++ flags.

kwatford
boost::make_shared works like a charm :)
Kensou