[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-dev] AMF::encodeObject,encodeElement

From: strk
Subject: Re: [Gnash-dev] AMF::encodeObject,encodeElement
Date: Tue, 18 Nov 2008 23:42:45 +0100

On Tue, Nov 18, 2008 at 09:08:52PM +0100, strk wrote:

> Now, the problem is that 'this' might not
> be refcounted yet. In our case it is indeed
> a stack-allocated Element (stack allocated in
> rtmpget.cpp). For this reason, when the scoped_ptr
> is constructed it sets refoucnt=1 and when it's 
> destructed it kills 'this', trying to delete a stack
> allocated object.

Sorry, my previous analisys was bogus.
It is correct when using intrusive_ptr, but not
when using shared_ptr.

When using shared_ptr you simply CAN NOT create
two distinct shared_ptr on the same pointer!

Doing so, will result in two distinct refcounts == hell.

So my naive fix (which was forcing refcount increment)
wasn't really a fix.

Guess the best we can do is provide an AMF::encodeElement(const Element&)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]