[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-dev] AMF::encodeObject,encodeElement
From: |
strk |
Subject: |
[Gnash-dev] AMF::encodeObject,encodeElement |
Date: |
Tue, 18 Nov 2008 21:08:52 +0100 |
Rob, while working on rtmpget I found a bug
in amf::Element::encode().
When the element is not of type object,
a shared_ptr is constructed with 'this'
for passing it to AMF::encodeElement.
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.
Now, avoiding any redesign attempt, is there any
reason for AMF::encodeElement to take a shared_ptr<Element>
rather then a const Element& ?
All the encoder does is serializign the Element, and
keeps no state between calls, right ?
--strk;
() ASCII Ribbon Campaign
/\ Keep it simple!
- [Gnash-dev] AMF::encodeObject,encodeElement,
strk <=