[Glass] Weird problem with class instance variable
Richard Sargent via Glass
glass at lists.gemtalksystems.com
Tue Aug 25 13:39:17 PDT 2015
GLASS mailing list wrote
> Hi guys,
>
> I define a classInstVars: called 'Instances' to keep track of new
> persistent instances in my class FaBackgroundProcess. Of course, I
> implement #new to add those there.
>
> But I am having a very strange issue now. I have this accessor:
>
> FaBackgroundProccess class >> instances
> ^ Instances ifNil: [ Instances := OrderedCollection new ]
> If I execute:
>
> FaBackgroundProcess instances ->>>>> anOrderedCollection( )
>
> I get an empty collection (which is what I expect). However, if I inspect
> the class FaBackgroundProcess and see the slot for 'Instances' I see lots
> of instances of FaBackgroundProcess! (when I expect to see same as the
> answer of #instances, that is, empty) And those instances are really alive
> as they prevent GC of other objects.
>
> So...what is going on???? I attach an screenshot with all the pieces. Any
> help is really welcome since I am lost.
Mariano, one possibility comes to mind. I'm not sure how you could have
created the scenario, but it may be worth checking. See if you have a global
definition of Instances somewhere other than the class variable. If the
method was compiled with a reference to an association in UserGlobals, for
example, you might be playing with two different associations. Browse the
reference paths to the two collections.
> Thanks in advance,
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
> _______________________________________________
> Glass mailing list
> Glass at .gemtalksystems
> http://lists.gemtalksystems.com/mailman/listinfo/glass
>
>
> Screen Shot 2015-08-25 at 5.02.48 PM.png (432K)
> <http://forum.world.st/attachment/4845738/0/Screen%20Shot%202015-08-25%20at%205.02.48%20PM.png>
--
View this message in context: http://forum.world.st/Weird-problem-with-class-instance-variable-tp4845738p4845750.html
Sent from the GLASS mailing list archive at Nabble.com.
More information about the Glass
mailing list