Exception on connecting two UniAlerters
Posted: Mon 11 Sep 2017 09:26
When two TUniAlerters are connected an Exception is raised. 'access violation at 0x0040a382: write of address 0x0000000c'. It happens not every time but very often.
I've made a test application. Very easy to reproduce. Change your database properties in main.pas and press the button.
The exception in the test application below can be avoided by connecting the second UniAlerter some time later by the use of a timer. Unfortunately this is not possible in our main application where we need two TUniAlerters that needs to be connected at the same time.
Devart Universal Data Access Components Version 7.0.2
Do I something wrong?
main.pas:
main.dfm :
I've made a test application. Very easy to reproduce. Change your database properties in main.pas and press the button.
The exception in the test application below can be avoided by connecting the second UniAlerter some time later by the use of a timer. Unfortunately this is not possible in our main application where we need two TUniAlerters that needs to be connected at the same time.
Devart Universal Data Access Components Version 7.0.2
Do I something wrong?
main.pas:
Code: Select all
unit Main;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, DAAlerter, UniAlerter, Data.DB,
DBAccess, Uni, Vcl.StdCtrls, UniProvider, PostgreSQLUniProvider;
type
TForm1 = class(TForm)
UniConnection1: TUniConnection;
UniAlerter1: TUniAlerter;
UniAlerter2: TUniAlerter;
Button1: TButton;
PostgreSQLUniProvider1: TPostgreSQLUniProvider;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
UniConnection1.Server := 'localhost';
UniConnection1.Port := 5432;
UniConnection1.Database := 'YourDatabase';
UniConnection1.Username := 'YourUserName';
UniConnection1.Password := 'YourPassword';
UniConnection1.Connect;
UniAlerter1.Active := True;
UniAlerter2.Active := True;
end;
end.
Code: Select all
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 281
ClientWidth = 418
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 8
Top = 8
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object UniConnection1: TUniConnection
ProviderName = 'PostgreSQL'
Left = 136
Top = 16
end
object UniAlerter1: TUniAlerter
Connection = UniConnection1
Events = 'Tom'
Left = 216
Top = 16
end
object UniAlerter2: TUniAlerter
Connection = UniConnection1
Events = 'Jerry'
Left = 296
Top = 16
end
object PostgreSQLUniProvider1: TPostgreSQLUniProvider
Left = 40
Top = 80
end
end