[Boost-bugs] [Boost C++ Libraries] #3274: Boost::sherad_ptr crash when used in stl queue

Subject: [Boost-bugs] [Boost C++ Libraries] #3274: Boost::sherad_ptr crash when used in stl queue
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-07-17 11:18:42


#3274: Boost::sherad_ptr crash when used in stl queue
------------------------------------------+---------------------------------
 Reporter: vikash.sharma@… | Owner: daniel
     Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: Regression Testing
  Version: Boost 1.37.0 | Severity: Regression
 Keywords: Boost::shared_ptr crash |
------------------------------------------+---------------------------------
 Hi,
 We have a scenario where we are storing instances of boost::shared_ptr in
 a stl queue. Then we pop the data out of Queue and do further processing.
 If i am correct then the pop() provided by stl queue calls the destructor
 of the object being popped out(which in this case would be
 boost::shared_ptr instance). This happens in a continuous daemon process
 which crashes at some random point say after 6 or 8 hrs because of boost
 pointer corruption. Am provding a small template below as per our
 implementation.

 boost::shared_ptr<Sample> spSample;
 spSample.reset(new Sample()) ;

 queue.push(spSample) ;

 //The below processing happens in a thread. No object is being shared
 between threads. Each thread has its own stl queue into which the data is
 pumped in by parent thread as shown above.
 boost::shared_ptr<Sample> spSample1 = q.front() ;
 q.pop() ; // Will call the destructor of the shared_ptr at q.front()

 //some function called which takes spSample1 as paramater
 func(spSample1) ;

 Is it safe to use boost::shared_ptr with stl queue ??

 We are using version 1.33.1.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3274>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC