realbasic-plugins
[Top] [All Lists]

Re: Event defines a Byref argument of type Variant

To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Subject: Re: Event defines a Byref argument of type Variant
From: Jonathan Johnson <jonj at realsoftware dot com>
Date: Sun, 29 Jan 2006 10:07:52 -0600
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=b8uzTy7bbFNhoGY99ksfe9R0sxzg10mhcrb/KF1Lay92fiqiTw0ZW3IuUrjF2EGD5lTj+vElTgLPHyyosFooWV0ns5gYZ1L5/ykhHHna11tRJ3uDWql+G9aYJL5l7xX1Gi12Gueu6W/lw/npGGzv38dWP8kI4RuuVgQk1HnxAI8=
References: <9d4cb5482cf867a2bda9cfe0e26d6ef5 at mac dot com>
On 1/29/06, Alfred Van Hoek <vanhoek at mac dot com> wrote:
> Given an event declaration like:
>
> "GetValue(selector as Integer, Byref Value As Variant) As Integer"
>
> The event is very simply implemented:
>
> Value = new Script // note: a plugin class not derived from RBScript
>
> return 0
>
> In plugin code we extract the script instance from the variant, and it
> appears that the refcount to this class remains 1 after returning from
> the event. Don't understand this, shouldn't the instance be unlocked
> automatically by RB once we loose scope, at least when returning to the
> main event loop?

It should only have one reference count. However, I think you'll find
that the value parameter you passed in byref actually contains a
different variant than you originally passed in. If the original
variant only has one reference, then it should be freed.

HTH,
Jon


--
Jonathan Johnson
REAL Software, Inc.

REAL World 2006, The REALbasic User's Conference
<http://www.realsoftware.com/realworld>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>