2012-08-07 164 views
2

我使用Boost 1.39。我已经使用boost::flyweight<no_locking, hashed_factory<> >实现了我的类(我的应用程序是单线程的)。我的课测试程序通过罚款,但是当我在应用程序中使用,我在增加flyweight恐慌

#9 0x08de7c3e in boost::flyweights::detail::refcounted_value<boost::flyweights::detail::default_value_policy<SharedFileAttr>::rep_type, SharedFileAttr>::release (this=0x0) at /usr/include/boost/flyweight/refcounted.hpp:89 
#10 0x08de7517 in boost::flyweights::detail::refcounted_handle<boost::flyweights::detail::refcounted_value<boost::flyweights::detail::default_value_policy<SharedFileAttr>::rep_type, SharedFileAttr> const*, boost::flyweights::detail::flyweight_core_tracking_helper<boost::flyweights::detail::default_value_policy<SharedFileAttr>, mpl_::na, boost::flyweights::refcounted, boost::flyweights::hashed_factory<mpl_::na, mpl_::na, mpl_::na, 0>, boost::flyweights::no_locking, boost::flyweights::static_holder> >::~refcounted_handle (this=0xf32fe61c, 
    __in_chrg=<value optimized out>) at /usr/include/boost/flyweight/refcounted.hpp:131 
#11 0x08e2edfe in boost::flyweights::flyweight<SharedFileAttr, boost::flyweights::no_locking, boost::flyweights::hashed_factory<mpl_::na, mpl_::na, mpl_::na, 0>, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::operator= (this=0xf32fe7e4, x=...) 
    at /usr/include/boost/flyweight/flyweight.hpp:196 

通知恐慌,在帧#9,这是为0x0

我不知道这怎么可能从我的代码使用boost :: flyweight来引起引用计数问题。毕竟,我的界面只包含添加flyweight对象的方法,并销毁它们。

我不知道如何解决问题。有任何想法吗?

+2

我们可能需要看一些代码来理解这一点。 – pmr 2012-08-07 12:23:22

回答

1

嗯,尴尬,但问题是试图分配一个未初始化的flyweight对象到另一个。必须记得初始化所有班级成员...