Boost logo

Boost :

From: (noreply_at_[hidden])
Date: 2004-07-11 22:04:51

Bugs item #989168, was opened at 2004-07-11 20:04
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:

Category: smart_ptr
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Peter Dimov (pdimov)
Summary: intrusive_ptr may cause dungling ptr access

Initial Comment:
I think intrusive_ptr may cause dungling ptr access in
multithreaded environment.

Currently, it's constructor is:

    intrusive_ptr(T * p, bool add_ref = true)
    : p_(p) /* the object may be deleted by other
                because this thread does not increment
reference counter yet. */
        if(p_ != 0 && add_ref)
            intrusive_ptr_add_ref(p_); /* this may occur
dungling ptr operation. */

We can avoid this problem by "addref-before-use" policy.

    intrusive_ptr(T * p, bool add_ref = true)
        if(p != 0 && add_ref)
            intrusive_ptr_add_ref(p_); /* other thread
never delete the object */
        p_ = p;


You can respond by visiting:

This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit
Boost-bugs mailing list

Boost list run by bdawes at, gregod at, cpdaniel at, john at