On Sun, May 29, 2011 at 22:01, Alfred Van Hoek <[email protected]> wrote:
> This is a difficult one, unless...
>
> In RBScript having a class say:
>
> class RBScriptObject
>        private dim instanceSig As Integer
>
>        sub Constructor(name As String, className As String, address As String)
>                numberOfObjects = numberOfObjects + 1
>                instanceSig = numberOfObjects
>                gObjectArray(instanceSig) = self
>        end sub
>
>        sub Destructor()
>                numberOfObjects = numberOfObjects - 1
>                gObjectArray(instanceSig) = nil
>                instanceSig = 0
>        end sub
> end class
>
> and global variables:
>
> dim gObjectArray(100) as RBScriptObject
> dim numberOfObjects As Integer = 0
>
> If the script is generating a number of local instances of the class and a 
> bunch of them go out of scope, the destructor of the class gets called, but 
> not in this example, because the gObjectArray holds a reference to it. 
> Because it is in RBScript, I have no idea how to make the array not to add a 
> ref to it, can't use REALUnlockObject, and looking in the language ref about 
> Weakref (which is unclear!), and noting that RBScript does not know anything 
> about WeakRef, I am at loss how to find a way to let the destructor fire, 
> other than not using an array...
>
> Someone out there giving a hint or two?
>
>
> - Alfred Van Hoek
> [email protected]
> http://web.mac.com/vanhoek

Please file a bug report with a simple example project. From there
we'll figure out what the behavior should be and fix anything if we
find it to be a bug (which I think is likely).

-- 
Joe Ranieri
Mac Frameworks & Compiler Engineer
Real Software, Inc.

_______________________________________________
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