As these call backs all return Handles, which I think implies local
handles and local handles can only exist inside a HandleScope, I infer
that callbacks are always called within a HandleScope.
Therefore I am guessing that a call back is never required to create a
HandleScope but that it should if it creates any handles besides the
one it will be returning. Is this correct?
Is the handle scope that is in effect when a call back isinvoked:
1) A scope that was created for the callback
2) The scope that was created by the outer application prior to
running the script or executing a Function->Call.
3) some intermediate scope with indeterminate lifetime
If the answer is #1 then handle scopes inside of call backs are only
useful to reclaim handles inside loops or functions with multiple
steps. If the answer is #2 then the callback has to be extremely
careful not to leak handles.
I could probably ferret out these details from the code, but I am
looking for some statement of the intended usage, not what may or may
not work in the current implementation.
--
Bryan White
We generally do use handle scopes, even in functions that only use a
small fixed number of local handles, but that's to reduce the total
number of handles allocated (and objects being kept alive thereby) and
because inserting handle scopes defensively makes it less likely that
you'll accidentally forget to use one where you should have.
-- Christian