Access violation with TOraAlerter component

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
wraaflaub
Posts: 4
Joined: Mon 01 Mar 2010 10:16

Access violation with TOraAlerter component

Post by wraaflaub » Tue 21 Sep 2010 11:51

Hello,
I'm using the TOraAlerter component and I'm getting access violations in the OnTimeout event handler when closing the application.
The effect can be reproduced with the Alerter demo application when the main thread is set to sleep for several seconds before the alerter is stopped. It seems to be a problem with the timing of the Windows messages. A OnTimeout event occurs after the alerter has been stopped, and the var parameter Continue refers to a variable that does not exist any more.
What can I do?
Best regards,
Walter Raaflaub

wraaflaub
Posts: 4
Joined: Mon 01 Mar 2010 10:16

Post by wraaflaub » Tue 21 Sep 2010 15:27

The problem can be reproduced when the following changes are made to the Alerter demo:

in Main.pas:

Code: Select all

procedure TfmMain.btStop2Click(Sender: TObject);
begin
  if OraAlerter2.Active then begin
    meLog2.Lines.Add('Setting main thread to sleep for 20s ...');
    sleep(20000);
    meLog2.Lines.Add('End sleep');
    OraAlerter2.Stop;
    meLog2.Lines.Add('Stoped');
  end;
end;

...

procedure TfmMain.OraAlerter2TimeOut(Sender: TObject;
  var Continue: Boolean);
begin
  meLog2.Lines.Add('TimeOut, set Continue := False');
  try
    Continue := False;
  except on e: Exception do
    meLog2.Lines.Add(e.message);
  end;
{$IFDEF MSWINDOWS}
  MessageBeep(0);
{$ENDIF}
end;
Clicking "Start" and then "Stop" on the right side reproduces the problem.

Post Reply