id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 445,Can't delete automatically in circularly included object.,nobody,Peter Dimov,"{{{ hi,all: I am a chinese student.Please forgive me because of my poor english. I found an error on smart pointer shared_ptr when i add an shared_ptr object to itself. The code is below.Class StatusBase is a subclass of Status.There is a method name addEventResult in class StatusBase. As you can see, EventResult is an object which made up of object Status( StatusBase actually because of Status is an abstract class ),Action and Event.In the case, I try to let them passed in share_ptr wrpper whenever in constructor or normal method.As my opinion,I think that will not be error and when I exit my program it will free the memory for me automatically. But in fact it will not. shared_ptr A( new Status() ); shared_ptr B( new Event() ); shared_ptr C( new Action() ); shared_ptr ABC( new EventResult( A, B, C ) ); //the row below will result the object A can't be released, so as to the object ABC , B and C A.addEventResult( ABC ); //next is about the decleartion of StatusBase and EventResult. For class Event and Action, it is the history. class StatusBase : public Status //{{{ { public: StatusBase(){} virtual ~StatusBase(){} public: int getEventResultCount() const ; boost::shared_ptr getEventResult( int index ) const ; void addEventResult( const boost::shared_ptr& v ) ; private: std::vector< boost::shared_ptr > events ; }; //}}} class EventResult : public pqkit::Object //{{{ { public: EventResult( const boost::shared_ptr& e, const boost::shared_ptr& a, const boost::shared_ptr& s ) : event(e),action (a),newStatus(s){} virtual ~EventResult() {} public: virtual const std::string toString() const { return Object::toString() ; } virtual const pqkit::Class getClass() const { return pqkit::Class(""EventResult"",""inhert:Object->EventResult""); } boost::shared_ptr getEvent() const { return event; } boost::shared_ptr getAction() const { return action; } boost::shared_ptr getNewStatus() const { return newStatus; } private: boost::shared_ptr event ; boost::shared_ptr action ; boost::shared_ptr newStatus ; }; //}}} yours JinheZeng at GDUT from China. }}}",Feature Requests,closed,To Be Determined,smart_ptr,None,Problem,wontfix,,