Gustav Schubert 25 Posted October 27, 2019 A minor problem: The TEdit may attempt to process clipboard content that was not put there for it to handle. Design time steps: 1. New empty FMX Application 2. Add components Button1: TButton; Edit1: TEdit; 3. Do in FormCreate ReportMemoryLeaksOnShutdown := True; Edit1.Width := 400 // optional 4. Implement ButtonClick Copy a TBitmap to the clipboard. ( see test code below that copies a screenshot of the form ) Runtime steps: Copy TBitmap to Clipboard. (click Button) Set Focus to TEdit control. (tab to Edit) Paste from Clipboard. (via ctrl V or via context menu) Assert that Edit1.Text contains '(TBitmapSurface @'. Close App. Observe that there is a Memory leak. Observations: a) (TBitmapSurface @ 0F83E7D0) appears as Edit1.Text b) Memory leak reported after Application shutdown 29 - 36 bytes: TBitmapSurface x 2 // Pasted via Ctrl V 29 - 36 bytes: TBitmapSurface x 3 // Pasted via Context Menu Implemetation details of test form: implementation uses FMX.Platform; {$R *.fmx} procedure TForm1.FormCreate(Sender: TObject); begin ReportMemoryLeaksOnShutdown := True; Edit1.Width := 400; end; procedure TForm1.Button1Click(Sender: TObject); begin CopyBitmap; end; procedure TForm1.CopyBitmap; var bmp: TBitmap; begin bmp := TBitmap.Create(Round(ClientWidth), Round(ClientHeight)); bmp.Clear(0); if bmp.Canvas.BeginScene then try PaintTo(bmp.Canvas); finally bmp.Canvas.EndScene; end; CopyBitmapToClipboard(bmp); bmp.Free; end; procedure TForm1.CopyBitmapToClipboard(ABitmap: TBitmap); var Svc: IFMXClipboardService; begin if not Assigned(ABitmap) then Exit; if TPlatformServices.Current.SupportsPlatformService(IFMXClipboardService, Svc) then Svc.SetClipboard(ABitmap); end; end. Share this post Link to post
Remy Lebeau 1394 Posted October 27, 2019 10 hours ago, Gustav Schubert said: A minor problem: The TEdit may attempt to process clipboard content that was not put there for it to handle. Sounds like a bug that you should report to Embarcadero directly. 1 Share this post Link to post
Gustav Schubert 25 Posted October 29, 2019 Reported as RSP-26546. The little problem was found in Meme-Builder-App, which is toy, but can be used as a test case. Share this post Link to post