Subject Re: strange bug with isc_que_events
Author svanderclock
hmm,

so is someone can explain me this bug :

i have a very very strange bug, i not understand.
I register an callback function with Firebird to
be alarmed of some event. I use TSimpleEvent to
make the thread wait from some call on the
callback function

everything work well Except when i manually
shutdown the FBserver.exe process. but in this case the
EventCallBack is also call, so from the point of view of
my application nothing change.

below the code simplified :

procedure EventCallback(UserData: Pointer; Length: Smallint; Updated:
PAnsiChar); cdecl;
begin
Writeln('EventCallback_start');
with TMyThread(UserData) do FSignal.SetEvent;
Writeln('EventCallback_end');
end;

TmyThread.execute
begin
....
FSignal.ResetEvent;
Fowner.FLibrary.EventQueue(...@EventCallback);
....
while not terminated do
try

...
writeln('waitfor_start');
FSignal.WaitFor(INFINITE);
writeln('waitfor_end');
...

except
On e: Exception do
Writeln(E.message):
end;


when some normal message come to the callback function,
this what we have on the consol app :

waitfor_start
EventCallback_start
EventCallback_end
waitfor_end
waitfor_start


but when i manually kill the FBserver.exe process, i receive :

waitfor_start
EventCallback_start
EventCallback_end
Access violation at address 77A71E1D in module 'ntdll.dll'. write of address
00000011
waitfor_start

Someone can Explain ???

how after the with TMyThread(UserData) do FSignal.SetEvent;
the instruction FSignal.WaitFor(INFINITE);
can raise an Access violation ??

doeas Firebird call the EventCallback the same way when fbserver is shuntdow than when a normal event is post? could it be possible that on the first case he call EventCallback in stdcall instead of cdecl ?


many thanks to anyone that can help me to understand this magic
"bug" ...

stephane