Boost logo

Boost Users :

Subject: [Boost-users] question about boost::intrusive_ptr
From: Mahmood Naderan (nt_mahmood_at_[hidden])
Date: 2011-08-05 06:38:17


Hi I used boost::intrusive_ptr in a function, say foo(), like this:     boost::intrusive_ptr<BranchFeedback> theFeedback ( new BranchFeedback() );     std::vector< std::vector< BPredState > >           theFetchState;     ....     theFeedback->theBPState = &theFetchState[anIndex][!anOne]; The difinition of BranchFeedback and BPredState are:   struct BranchFeedback : boost::counted_base {     ...     boost::intrusive_ptr<BPredState> theBPState;    };   struct BPredState : boost::counted_base {     ...     uint32_t theGShare;     uint32_t theSerial;   }; The problem is when foo() reaches the end (I mean '}'), I get segmentation fault which points to     ~intrusive_ptr()     {         if(p_ != 0) intrusive_ptr_release(p_);     } I thought I used the intrusive_ptr in a correct way. Is there any consideration that I missed? Thanks,   // Naderan *Mahmood;


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net