08-28-2019, 06:06 PM
(This post was last modified: 08-29-2019, 11:58 PM by Alexandre Machado.)
IW is trying to clear an uncreated object, Add Lines commented below //OPH20190826 Prevent Bug
unit IWCallBackFunc;
//OPH20190826 Prevent Bug
interface
...
implementation
...
procedure TIWCallBacks.Invoke(ACallbackRec: TIWCallbackRec);
var
LResult: string;
LHandled: Boolean;
LForm: TIWForm;
LSession: TIWApplicationAccess;
begin
LSession := TIWApplicationAccess(FSession);
if not Assigned(LSession) or not Assigned(LSession.ActiveForm) then begin
Exit;
end;
LForm := TIWForm(LSession.ActiveForm);
try
//Pass a copy of all Request params to the Callback.
if not Assigned(FEventParams) then begin
FEventParams := TIWStringList.Create;
end;
FEventParams.AddStrings(LForm.Params, False);
if Assigned(ACallbackRec.Method) then begin
ACallbackRec.Method(FEventParams);
end else if Assigned(ACallbackRec.Proc) then begin
LResult := '';
LHandled := False;
ACallbackRec.Proc(FEventParams, LResult, LHandled);
if LHandled then begin // user code handles the response
LSession.CallBackResponse.SendResponse := False;
Exit;
end;
if LResult <> '' then begin
// Write result to response as is
LSession.CallBackResponse.AddRawText(LResult);
end;
end;
if LForm.SendAJAXNotification then begin
LSession.CallBackResponse.AddJavaScriptToExecute(LForm.GetIWAJAXNotificationJSCode);
end;
finally
if Assigned(FEventParams) then //OPH20190826 Prevent Bug
FEventParams.Clear;
end;
end;
...
unit IWCallBackFunc;
//OPH20190826 Prevent Bug
interface
...
implementation
...
procedure TIWCallBacks.Invoke(ACallbackRec: TIWCallbackRec);
var
LResult: string;
LHandled: Boolean;
LForm: TIWForm;
LSession: TIWApplicationAccess;
begin
LSession := TIWApplicationAccess(FSession);
if not Assigned(LSession) or not Assigned(LSession.ActiveForm) then begin
Exit;
end;
LForm := TIWForm(LSession.ActiveForm);
try
//Pass a copy of all Request params to the Callback.
if not Assigned(FEventParams) then begin
FEventParams := TIWStringList.Create;
end;
FEventParams.AddStrings(LForm.Params, False);
if Assigned(ACallbackRec.Method) then begin
ACallbackRec.Method(FEventParams);
end else if Assigned(ACallbackRec.Proc) then begin
LResult := '';
LHandled := False;
ACallbackRec.Proc(FEventParams, LResult, LHandled);
if LHandled then begin // user code handles the response
LSession.CallBackResponse.SendResponse := False;
Exit;
end;
if LResult <> '' then begin
// Write result to response as is
LSession.CallBackResponse.AddRawText(LResult);
end;
end;
if LForm.SendAJAXNotification then begin
LSession.CallBackResponse.AddJavaScriptToExecute(LForm.GetIWAJAXNotificationJSCode);
end;
finally
if Assigned(FEventParams) then //OPH20190826 Prevent Bug
FEventParams.Clear;
end;
end;
...