Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • Lazarus Lazarus
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 2,102
    • Issues 2,102
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FPC
  • LazarusLazarus
  • LazarusLazarus
  • Issues
  • #34795
Closed
Open
Issue created Jan 02, 2019 by FPC Admin account@fpc_adminOwner

[Patch] GTK2: Clipboard.AsText crashs sometimes.

Original Reporter info from Mantis: engkin @engkin
  • Reporter name:

Description:

In \lcl\interfaces\gtk2\gtk2winapi.inc file, Function TGtk2WidgetSet.ClipboardGetData: SupportedFormats gets the same address from SelData.Data:

SupportedFormats:=PGdkAtom(SelData.Data);

at the end of ClipboardGetData both get freed:

      finally
        if SupportedFormats<>nil then FreeMem(SupportedFormats);
        if SelData.Data<>nil then FreeMem(SelData.Data); //<--- this may cause a crash
      end;
    end;

The attached patch

Steps to reproduce:

Download the project which I'll attach in a comment.
Compile and run after using GTK2 as the widgetset.
Copy any image from the forum and click the button labeled "Clipboard.AsText".

Additional information:

Forum member dbannon (Davo) reported the issue here:
http://forum.lazarus.freepascal.org/index.php/topic,43750.0.html

He also provided a sample project which I'll include in this report in the first comment.

Mantis conversion info:

  • Mantis ID: 34795
  • OS: Linux/Win
  • OS Build: any
  • Version: 1.8.2
  • Fixed in revision: r60064 (#6831ce0d)
Assignee
Assign to
Time tracking