From: Mark <mnmfactory@co...> - 2004-01-14 20:42:58
I've hit an AV with the current CVS code (pulled today). It's been quite a while since I've pulled DWS from CVS at work (that's where I am now) so don't assume it is a recently created problem.
I'm not sure if something is wrong with the my Tdws2ClassesLib component or not. This appears to be related to my wrapper. I would appreciate any help that can be offered.
Script to demonstrate issue:
var sl: TStringList;
sl := TStringList.Create;
sl.Add('This is a string.');
sl.Add('This is another.');
+ Start with the Simple DWS demo.
+ Drop a Tdws2ClassesLib (from \dws2\Libraries\VclWrappers) on and hook to compiler.
+ Run app, and paste in above script.
+ Compile the program (nothing wrong)
+ Execute the program (nothing wrong)
+ Compile the program AGAIN. (AV error)
I've traced the error down to here...
function TSymbolTable.FindLocal(const Name: string): TSymbol;
var x: Integer;
Result := nil;
// Lookup in Hot-list
for x := 0 to SymbolCacheSize - 1 do
if Assigned(FHot[x]) and (SameText(FHot[x].Name, Name)) then
The context is...
Coming from "TProgram.DestroyScriptObj()" to destroy the TStringList object it calls "TSymbolTable.FindSymbol('Destroy')" which in turn calls the FindLocal method.
The error is with the FHot array. One of the array indexes is invalid at this point and gives an AV. I'm not sure if I need to change the way code is generated and registered or what.
Thanks in advance.
From: Andreas Luleich <aluleich@we...> - 2004-01-14 23:35:51
I found your reported bug. Problem was method TAnonymousMethod.Call in
TAnonymousMethod.Call saved the "Self"-ScriptObject at call time to
"FInfo.ScriptObj" (and did not reset it on finish). So the script object
was not freed at end of the program (with static symbols in
classeslib!), because there were references to the script object in any
of the called "TAnonymous" objects.
I fixed that and checked in CVS (dws2Functions.pas rev 1.8).
Good luck, ALu.
From: Mark <mnmfactory@co...> - 2004-01-15 00:14:24
Andreas Luleich wrote:
> Hi Mark,
> I found your reported bug. Problem was method TAnonymousMethod.Call in
Man, you are amazing! How did you do that? I appreciate it very much.
Hope you didn't have to invest too much time into it.