Passing an Object Ref

Martin Obongita martin.obongita at yahoo.com
Wed Dec 21 11:24:50 UTC 2022


Hi Kelly, 
Does the receiving class have to calculate the $newref to the objclass or this will clear the reference to the referenced instance?

Martin.



Sent from Yahoo Mail on Android 
 
  On Wed, 21 Dec 2022 at 10:15, Kelly Burgess<kellyb at montana.com> wrote:   Andy wrote:
>It is certainly ‘allowed’ but passing an instance variable from a window would mean you may have issues of remaining in scope

Maybe scope can come into play, but the nice thing about object references is the way you can pass them around.  If you have an Object Reference instance variable in several windows and reports, you can instantiate some object using $newref() in one window instance, store the object reference in the instance variable, and then you can pass it around to all the other interested window and report instances, using a method with an Object Reference type parameter, where they just

  Calculate iThingManagerObjRef as pThingMgrObjRef

so the object is available to all of those instances using their own instance variables, and the only issue is when some instance calls $deleteref() on that object reference, all the other instances need to be informed that their copy of the objRef is stale and unusable.  I haven't tested thoroughly, and I know Omnis has enhanced their garbage collection, but I'm thinking that if I close the instance of the window where I created an object with $newref, and if that window's $destruct method doesn't call $deleteref, then the object is still available to other instances that got a copy of the object reference.

Kelly
_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
  


More information about the omnisdev-en mailing list