On Jun 27, 2007, at 8:36 PM, Jonathan Johnson wrote:

>
> On Jun 27, 2007, at 7:33 PM, Alfred Van Hoek wrote:
>
>>
>> Based on the notion that the retInstance comes from the RB
>> environment, we really should not unlock it because once the event/
>> interface method goes out of scope, RB will reduce the refcount on
>> the retInstance,  right?
>
> No, the event has already exited, and there is no further cleanup to
> be done. Both objects stored in byref parameters and return values
> must be unlocked to prevent leaking.

hmm, if someone in such an event is creating a local instance

                dim c as myClass = new myClass

and returns it

                return c

then the refcount remains 1 if we don't unlock it? (According to  
Christian)

The problem is that we do it as:
                dim key as string = "myString"
                dim c as myClass = myDict.value(key)
                return c

If we don't unlock we leak sometimes, and if we do unlock, we crash  
after a couple of times, because the destructor of the stored object  
was called. The crash occurs then when myDict.value(key) is called.

This is when we use an Interface method, have to investigate if a  
REALevent definition is stable.

ALfred
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to