|
Boost : |
Subject: [boost] cannot pass objects of non-POD type âclass boost::detail::shared_countâ through â...â; call will abort at runtime
From: Dave Steffen (dave.steffen_at_[hidden])
Date: 2009-09-17 13:08:43
Peter Dimov wrote:
> I wrote:
>>
>>( Just tried to compile my project with GCC 4.3 and Boost 1.40. (It
>> compiles and works just fine with Boost 1.38.)
>>
>> As part of a home-built thread-locking shared pointer thing, we have
>> this code:
[...]
>
> The signature of sp_enable_shared_from_this has changed, it now takes a
> pointer to a shared_ptr as its first argument. Look at the current
> shared_ptr constructor:
>
> template<class Y>
> explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete
> {
> boost::detail::sp_enable_shared_from_this( this, p, p );
> }
>
> Relying on implementation details has its maintenance costs. :-)
Yeah. There are actually much better ways to do this now, like
Boost threads and some other things, that weren't available when we
started the project. It's also true that some refactoring would
make the whole point moot, but I was really hoping to avoid tackling
that on the current contract.
> You'll probably need to refactor shared_locking_ptr to contain (or
> privately derive from) a shared_ptr.
... which, arguably, we could have done in the first place. I'm
inclined to refactor the whole issue out of our code at this
point. :-)
Anyway, thanks for the reply. I'm off to refactor.
-- Dave Steffen - Software Engineer Numerica Corporation (www.numerica.us <http://www.numerica.us/> ) 4850 Hahns Peak Drive, Suite 200 Loveland, Colorado 80538 main (970) 461-2000 x 227 direct (970) 612-2327 fax (970) 461-2004 Email: dave.steffen_at_[hidden] k
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk