|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-09-07 19:02:42
Boris Gubenko wrote:
> It segfaults, with and without -O0:
>
> Program received signal SIGSEGV, Segmentation fault
> si_code: 1 - SEGV_MAPERR - Address not mapped to object.
> 0x408b831 in
> boost::detail::sp_counted_impl_pd<n_report_2::foo*,n_report_2::deleter>::boost::detail::sp_counted_impl_pd<n_report_2::
> foo*,n_report_2::deleter> (
> this=0x40014c30, p=0x40014bd0, d={<No data fields>})
> at sp_counted_impl.hpp:140
The relevant portion of shared_ptr_test seems to be n_report_2, reproduced
below; it seems that the fault is occuring at the very first line of test().
I really can't see anything wrong with it; the test passes on every other
platform.
class foo
{
public:
void setWeak(boost::shared_ptr<foo> s)
{
w = s;
}
private:
boost::weak_ptr<foo> w;
};
class deleter
{
public:
deleter(): lock(0)
{
}
~deleter()
{
BOOST_TEST(lock == 0);
}
void operator() (foo * p)
{
++lock;
delete p;
--lock;
}
private:
int lock;
};
void test()
{
boost::shared_ptr<foo> s(new foo, deleter());
s->setWeak(s);
s.reset();
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk