RE: [Boost-users] boost::shared_ptr inside std::list
-----Original Message----- From: James Mastro [mailto:jmastro@rochester.rr.com] Sent: Thursday, 13 November 2003 11:59 AM To: Boost Users mailing list Subject: [Boost-users] boost::shared_ptr inside std::list
This one has been driving me nuts all day. In a function I have the following:
std::list< boost::shared_ptr<MyObject> > * objectList;
An uninitialized pointer to a list of shared pointers to MyObject is probably not what you wanted, but its what you defined. I don't think you bug has anything to do with shared pointers...
When debugging my code, the debugger (gdb) dies upon entering the function with this in it. It says "The Debugger has exited due to signal 11 (SIGSEGV).The Debugger has exited due to signal 11 (SIGSEGV)." My dev tools felt the need to say it twice for some reason. I pulled this out and put it in a new project all by itself with the same result.
If I make it not be a pointer, like this:
std::list< boost::shared_ptr<MyObject> > objectList;
then there's no problem.
Regards Darryl. ########################################################################## This e-mail is for the use of the intended recipient(s) only. If you have received this e-mail in error, please notify the sender immediately and then delete it. If you are not the intended recipient, you must not use, disclose or distribute this e-mail without the author's prior permission. We have taken precautions to minimise the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this message. We cannot accept liability for any loss or damage caused by software viruses. ##########################################################################
On Nov 12, 2003, at 10:09 PM, Darryl Green wrote:
std::list< boost::shared_ptr<MyObject> > * objectList;
An uninitialized pointer to a list of shared pointers to MyObject is probably not what you wanted, but its what you defined.
The actual code looks like std::list< boost::shared_ptr<MyObject> > * objectList = GetObjectList();
I don't think you bug has anything to do with shared pointers...
Correct. I think display of the value in the debugger was causing it to die. -jim
participants (2)
-
Darryl Green
-
James Mastro