mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-21 18:06:30 +02:00
Merge branch 'fix_gtk2_clipboard_leak' into 'main'
gtk2: fix resource leak (gtk_clipboard_wait_for_contents). Issue #40499 See merge request freepascal.org/lazarus/lazarus!235
This commit is contained in:
commit
a018a3ca41
@ -7600,6 +7600,7 @@ var
|
|||||||
TimeID: cardinal;
|
TimeID: cardinal;
|
||||||
EventData: PClipboardEventData;
|
EventData: PClipboardEventData;
|
||||||
TypeAtom: TGdkAtom;
|
TypeAtom: TGdkAtom;
|
||||||
|
GtkSelectionDataPtr: PGtkSelectionData;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG_CLIPBOARD}
|
{$IFDEF DEBUG_CLIPBOARD}
|
||||||
DebugLn('[RequestSelectionData] FormatID=',dbgs(FormatID));
|
DebugLn('[RequestSelectionData] FormatID=',dbgs(FormatID));
|
||||||
@ -7634,8 +7635,10 @@ begin
|
|||||||
// WaitForClipboardAnswer provides a timeout as in some cases
|
// WaitForClipboardAnswer provides a timeout as in some cases
|
||||||
// gtk_clipboard_wait_for_contents can wait forever
|
// gtk_clipboard_wait_for_contents can wait forever
|
||||||
if WaitForClipboardAnswer(EventData) then begin
|
if WaitForClipboardAnswer(EventData) then begin
|
||||||
gtk_clipboard_wait_for_contents(gtk_clipboard_get(TypeAtom), FormatID);
|
GtkSelectionDataPtr := gtk_clipboard_wait_for_contents(gtk_clipboard_get(TypeAtom), FormatID);
|
||||||
Result:=EventData^.Data;
|
if GtkSelectionDataPtr <> nil then
|
||||||
|
gtk_selection_data_free(GtkSelectionDataPtr);
|
||||||
|
Result:=EventData^.Data; //why aren't we using the returned object from gtk_clipboard_wait_for_contents directly?
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
|
Loading…
Reference in New Issue
Block a user