2012-08-07 98 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對象到另一個。必須記得初始化所有班級成員...