> 
> Do you add 1 to ref count of collections object when you start a 
> for each loop?  If so, do you decrement at end?
>
For each is supposed to work as follows.

1.  Powerpro.exe calls your foreach callback.

2.  Your plugin calls setvar on the foreach variable to overwrite its current 
value with a the next result in the enumeration.

3.  setvar calls changerefifhandle which calls your free function if the 
variable being set already contains a handle (note:  the old value of the for 
each variable is what I mean, not the new value being set).

4.  Your plugin returns from doforeach.

5.  Processing in powerpro.exe now calls changerefifhandle on the foreach 
variable, which will call back to your plugin to increment ref count.

I won't have time to track your script execution from powerpro.exe end until at 
least late in the weekend .  If you wanted to play with it before then, you 
could insert traces in your plugin in the foreach, free, and ref increment 
callbacks, and so see if they are called as expected.  You could include the 
scriptline number in the trace (getvar("scriptline")) to help relate the trace 
to the executing script.

I don;t know how the ref count for the enumeration handle got set to two.  I or 
you would need to do some tracing to find out at what script line that is 
happening.



Reply via email to