After migration from v9.4.3 to v10.0.2, SDAC raises error 'Not enough timers available' in thread
Posted: Mon 24 Jan 2022 11:22
Hi!
To reproduce it place on form
MSConnection
MSQuery
Set MSQuery1.Options.NonBocking := True
Set MSQuery1.SQL.Text any SELECT query
Add code below in button on click and execute the code
TThread.CreateAnonymousThread(
procedure
begin
CoInitialize(nil);
try
MSQuery1.Close;
MSQuery1.Open;
finally
CoUninitialize;
end;
end).Start;
set debug point on MSQuery1.Close and run (F9) in debug mode, on first executing (click button) this code it's ok but on second executing (click button) you will see error 'Not enough timers available' on line 'MSQuery1.Close'.
This problem happened in CRTimer unit in code
procedure TCRTimer.UpdateTimer;
begin
KillTimer(FWindowHandle, 1);
if (FInterval <> 0) and FEnabled and Assigned(FOnTimer) then
if SetTimer(FWindowHandle, 1, FInterval, nil) = 0 then
raise EOutOfResources.Create(SNoTimers);
end;
What was changed in SDAC that components brings this error and how to fix it? Also, as I understand that NonBocking options is used especially for threads but now looks like NonBocking := false works good.
Thank you.
To reproduce it place on form
MSConnection
MSQuery
Set MSQuery1.Options.NonBocking := True
Set MSQuery1.SQL.Text any SELECT query
Add code below in button on click and execute the code
TThread.CreateAnonymousThread(
procedure
begin
CoInitialize(nil);
try
MSQuery1.Close;
MSQuery1.Open;
finally
CoUninitialize;
end;
end).Start;
set debug point on MSQuery1.Close and run (F9) in debug mode, on first executing (click button) this code it's ok but on second executing (click button) you will see error 'Not enough timers available' on line 'MSQuery1.Close'.
This problem happened in CRTimer unit in code
procedure TCRTimer.UpdateTimer;
begin
KillTimer(FWindowHandle, 1);
if (FInterval <> 0) and FEnabled and Assigned(FOnTimer) then
if SetTimer(FWindowHandle, 1, FInterval, nil) = 0 then
raise EOutOfResources.Create(SNoTimers);
end;
What was changed in SDAC that components brings this error and how to fix it? Also, as I understand that NonBocking options is used especially for threads but now looks like NonBocking := false works good.
Thank you.