Project JEDI - Issue Tracker - JEDI VCL
Viewing Issue Advanced Details
3577 00 JVCL Components major always 2006-03-14 05:32 2006-03-20 04:53
ivan_ra  
AHUser  
normal  
resolved 3.10  
fixed  
none    
none 3.30  
0003577: JvInterpreter: incorrect finally/except block handling (workaround)
for scripts having "Exit" statement inside "try" block Jvinterpreter executes only first statement from finally/except block. This is example:

procedure TestScript;
var
  StringList:TStringList;
begin
  StringList:=TStringList.Create;
  try
    Exit;
  finally
    ShowMessage('one'); // 1
    ShowMessage('two'); // 2
    StringList.Free; //3
  end;
end;

In this script JvInterpreter executes only first statement
The cause of problem is incorrect using of FExit flag in TJvInterpreterFunction.InterpretTry.DoFinallyExcept procedure. It calls InterpretBegin and InterpretBegin exits after first statement because FExit=true.
DoFinallyExcept must save FExit, substitute it and restore in on exit:

  procedure DoFinallyExcept(E: Exception);
  var OldExit:boolean;
  begin
    OldExit:=FExit;
    try
      FExit:=false;
      ...
    finally
      FExit:=FExit or OldExit;
    end;
  end;
Issue History
2006-03-14 05:32 ivan_ra New Issue
2006-03-14 05:35 ivan_ra Note Added: 0008663
2006-03-20 04:53 AHUser Status new => resolved
2006-03-20 04:53 AHUser Resolution open => fixed
2006-03-20 04:53 AHUser Assigned To => AHUser
2006-03-20 04:53 AHUser Note Added: 0008704

Notes
(0008663)
ivan_ra   
2006-03-14 05:35   
I can not make patch right now because anonimous CVS not working. May be later
(0008704)
AHUser   
2006-03-20 04:53   
Fixed in CVS.