Subject TIB_Events
Author Robert martin
Hi

I have setup a TIB_Events for each 'Company' managed by our
application. It is working great, in that it triggers correctly and
runs just fine. However (most times) when I close the app I get a
GDS32.dll error. It seems to be triggering when I disconnect from the
database, although I cannot be 100% sure. Can anybody offer some
suggestions.

TIA


My code follows.


In the TCompany class it is setup like this...


fIb_Events := TIB_Events.Create(fSession);
fIb_Events.IB_Connection := DataBase;
fIb_Events.Events.Clear;
fIb_Events.Events.Add('ProcessEvent_Changed');
fIb_Events.OnEventAlert := TriggerEvent;

When the Database is connected the following code runs...

if (fAvailable = True) then begin
if (fIb_Events.Registered = False) then begin
fIb_Events.RegisterEvents;
end;
end;

And when it is disconnected (It sometimes is connected and disconnected
multiple times during the classes life) ...

if (fAvailable = False) then begin
if (fIb_Events.Registered = True) then begin
fIb_Events.UnregisterEvents;
end;
end;

In the TCompany destructor ...


fIb_Events.OnEventAlert := Nil;

if (DataBase.Connected = True) then begin
if (fIb_Events.Registered = True) then begin
fIb_Events.UnregisterEvents;
end;
end;

fIb_Events.IB_Connection := Nil;
fIb_Events.Free;

....

DataBase.Connected := False;
DataBase.Free;


--
Rob Martin
Software Engineer

phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com

Wild Software Ltd