The component survives being dropped on a form
The component can be dropped on a form again. Under Free Pascal it used to
crash there, and when it survived it came up black.
The timer contract is not the same on both compilers
The component drives itself from a precise timer. Under Delphi that timer is a
window timer: the handler runs in the main thread, and painting from it is
ordinary painting. Under Free Pascal the same class runs a thread of its own and
calls the handler there. So the handler painted from a worker thread while the
main thread painted the same control, and the pen cache of the LCL does not
survive that. Measured before the fix: six crashes in ten runs. After: none.
The handlers no longer do the work. Each one posts a message to its own window,
and the work happens in the main thread where it belongs. The contract itself is
now written down in the header of the timer unit, so the next reader does not
have to discover it from a crash.
The same change closed a smaller defect: a wheel step could be lost. The zoom
direction was written by the main thread and read - and cleared - by the timer
thread. Both ends are in the main thread now.
Why it was black
Under the LCL the default Color of a control is clDefault. That is not a
colour but an instruction to ask the environment for one, and an off-screen
bitmap has no environment to ask: the request resolved to black. Under Delphi
the same line produced the ordinary window colour.
The buffer is now filled with a resolved colour, and the two fonts the component
owns are given explicit defaults instead of inheriting the same uncertainty.
Installing the package into the IDE
The Lazarus package now declares itself usable at design time and declares the
dependency it always had. Without both, the IDE either refused the package or
rebuilt itself without the units it needed, and the component never reached the
palette. Checked by installing it: the component can be placed on a form with
the mouse.
One thing we saw once and cannot explain yet
The new gate puts the component on a form over and over and checks that a graph
actually appeared. In one run of an early batch the picture came out empty. It
has not happened again in a hundred and thirty-eight runs since, and in none of
those runs did the thread watchdog fire or anything crash - the defect this
release fixes did not occur once.
We do not know the cause. It is written down here rather than left out, because
the check that found it did not exist before this release: nobody could have
seen this earlier. The gate stays in the matrix, and it now saves evidence at
the moment of an empty result - how much deferred work was posted and handled,
the state of the control, and the picture itself - so that the next occurrence
is a diagnosis rather than a guess.
Compatibility
| Delphi | 37.0 (Delphi 13), win32 and win64 |
| Free Pascal | 3.2.2 and 3.3.1, win32 and win64 and linux64 |