Forum > GTK
Is there a leak when calling gtk_clipboard_wait_for_contents (gtk2)
(1/1)
WayneSherman:
This appears to be a leak when gtk_clipboard_wait_for_contents is called from gtk2proc.inc at line 7637.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---if WaitForClipboardAnswer(EventData) then begin gtk_clipboard_wait_for_contents(gtk_clipboard_get(TypeAtom), FormatID); Result:=EventData^.Data;end;
The gtk2 docs for gtk-clipboard-wait-for-contents state:
--- Quote ---Returns a newly-allocated GtkSelectionData object or NULL if retrieving the given target failed. If non-NULL, this value must be freed with gtk_selection_data_free() when you are finished with it.
--- End quote ---
So if it returns non-NULL, GtkSelectionData must be freed, but the code in Lazarus is not capturing the return value.
JuhaManninen:
Can you please provide a patch to fix it.
GTK memory leaks are difficult to notice because they don't usually show in normal heaptrace output.
WayneSherman:
--- Quote from: JuhaManninen on September 09, 2023, 09:38:07 pm ---Can you please provide a patch to fix it.
--- End quote ---
Yes, issue and merge request created:
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40499
Navigation
[0] Message Index