For loop variables are just plain locals, so the plugin won't get the final ref 
count decrement (by calling freecallback) until end of script unless you force 
it as you attempted with the assignment.

The document for ref counting is pretty poor.  Is it clear that the plugin 
needs to delete the object from within your plugin  in two cases:
1.  If the ref count goes down  to  zero when you decrement in  your 
freecallback is called (the one supplied in register sig).

2.  If the ref count is zero when the refcallback function (the one supplied in 
setaddrefcallback) is called with a second argument of zero.



--- In [email protected], "entropyreduction" 
<alancampbelllists+ya...@...> wrote:
>
> 
> 
> --- In [email protected], "entropyreduction" 
> <alancampbelllists+yahoo@> wrote:
> 
> zeroing ref count for locals (that should go out of scope and die anyway) 
> doesn;t make problem go away:
> 
> local objFile            
> local hCollectionFiles = objFolder.Files
> for each objFile  in hCollectionFiles
>   win.debug(" com handle: " ++ objFile ++ " ref cnt: " ++ objFile._refs__ ++  
> ", name: " ++ objFile.Name) 
> endfor
> objFile  = ""
> hCollectionFiles = ""
>  
> > 
> > --- In [email protected], "brucexs" <brucexs@> wrote:
> 
> > Meanewhile, got a problem, using ref counting, using PowerPro 4.9.1.8
> > PowerPro 4.9m7  21/03/2010.
> > 
> > using a subset of
> > comPluginDemoScriptFileSysObjDotSyntaxForEach.powerpro
> > from com distro, modified to remove release calls and such.
> > 
> > objFSO = com.create_object("Scripting.FileSystemObject") 
> > ; objFSO displays as "c\x05 0000"
> > 
> > local objFolder = objFSO.GetFolder(scriptfolder)
> > ; objFolder displays as "cx05 0001"
> > 
> > win.debug("Here's a list of files in " ++ scriptfolder ++ ":")
> > for each objFile  in objFolder.Files
> > ; objFile (handle) displays as "c\x05 0003" 
> > ;(for each objFile) first time into script
> > ; "c\x05 0004" (for each objFile) next time into script, etc
> > 
> >   win.debug("handle: " ++ objFile ++ " ref cnt: " ;;+
> >    ++ objFile._refs__ ++  ",name: " ++ objFile.Name) 
> > endfor
> > 
> > quit
> > 
> > 'same thing happens this way
> > local hCollectionFiles = objFolder.Files
> > for each objFile  in hCollectionFiles
> >   win.debug(" com handle: " ++ objFile ++ " ref cnt: " ;;+
> >    ++ objFile._refs__ ++  ", name: " ++ objFile.Name) 
> > endfor
> > 
> > ;note enumerator generated from objFolder.Files begins "e\x05 " and ;is 
> > correctly released in forEach callback code (checked in debugger).
> > 
> > Looks like maybe last handle obtained by enumerator (stored in objFile) the 
> > last time through for each loop isn't getting released.  Could be my code?
> >
>


Reply via email to