running at full CPU when it should be Idle (modal form + ReleaseComponents)
Original Reporter info from Mantis: Martin @martin_frb
-
Reporter name: Martin Friebe
Original Reporter info from Mantis: Martin @martin_frb
- Reporter name: Martin Friebe
Description:
Can be observed with the new Src-Win-Mgr. (but IMHO is not a fault of it)
- open it via keyboard ctrl-shift-W
- tick the checkbox of the SynEdit, that was active (and therefore
handles the KeyDown)
- Close it (from within the mgr)
Now we have full CPU (1 core at 100%)
The reason is in
procedure TApplication.ReleaseComponents;
which runs at Idle, as well as at a queued async call
It checks if the componont is still ref counted:
if (Component is TLCLComponent)
and (TLCLComponent(Component).LCLRefCount>0) then begin
// add again to FComponentsToRelease
ReleaseComponent(Component);
end else begin
// this might free some more components from FComponentsReleasing
Component.Free;
In the given case, the "ShowModal" is called in the KeyDown handler.
Therefore as long as the Form is shown, the Componont can not be
destroyed and will be rescheduled.
Unfortunately the re-schedule runs immediately. Creating an endless loop.
Mantis conversion info:
- Mantis ID: 21451
- Version: 0.9.31 (SVN)
- Fixed in version: 2.2
- Fixed in revision: 64435 (#6fc365af)
- Target version: 2.2