Memory leak in TFPCustomCanvas
Original Reporter info from Mantis: wp @wpam
-
Reporter name:
Original Reporter info from Mantis: wp @wpam
- Reporter name:
Description:
When debugging the memory leak of TAChart reported in #0024296 I came across a memory leak in TFPCustomCanvas: In TFPCustomCanvas.SetClipRect (in fpcanvas.inc) a new clipping region is created and assigned to FClipRect. In the destructor of TFPCustomCanvas, however, FClipRect is not destroyed.
The attached patch calls FreeAndNil(FClipRect) in TFPCustomCanvas.Destroy.
Steps to reproduce:
The attached demo activates Canvas.Clipping for the Form's canvas. If you run the demo with the heaptrc compiler option set, a memory leak will be reported.
After applying the patch, the memory leak is gone. The patch also fixes the memory leak reported in #0024296 for TAChart.