增强蝇量级恐慌

boost flyweight panics

本文关键字:增强      更新时间:2023-10-16

我正在使用Boost 1.39。我已经使用 boost::flyweight<no_locking, hashed_factory<> > 实现了我的类(我的应用程序是单线程的)。我的类的测试程序通过得很好,但是当我在应用程序中使用 in 时,我感到恐慌

#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 导致引用计数问题。毕竟,我的界面只包含添加蝇量级对象并销毁它们的方法。

我不知道如何找出问题所在。有什么想法吗?

嗯,很尴尬,但问题是试图将一个未初始化的蝇量级对象分配给另一个对象。必须记住初始化所有类成员...