Re: boost::shared_ptr weirdness

Murray Cumming wrote:
Paul Davis <pjdavis engineering uiowa edu> writes:

Has anyone ever noticed weird behavior with boost::shared_ptrs and
widgets?  I've been getting some random segfaults when closing my
programs.  They seem to be coming from removing a container that
contains a widget that is a member of an object referenced by a
shared_ptr.  I think.  I haven't gotten it to be reproducible.  I'm
just using this as a shot in the dark to see if there are documented
no-no's for using boost's shared pointers or something.

boost::shared_ptr<> is not thread safe. Other than that, they behave
like any other object. I tend to use Glib::RefPtr<> in gtkmm code
and boost::shared_ptr<> in libs and other non UI dependent code.

valgrind's memcheck is incredibly useful for these kinds of problems.

Murray Cumming
murrayc murrayc com

gtkmm-list mailing list
gtkmm-list gnome org

The docs have a note on threads although I can't speak for it since I've never tested it:

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]