Gtk3: fixed memleak and list usage. Patch by Anton Kavalenka, modified by me. issue #41375

This commit is contained in:
zeljan1 2025-01-29 19:03:53 +01:00
parent f302e2508c
commit 572cc8bbf4

View File

@ -108,8 +108,8 @@ begin
ypad := 0; ypad := 0;
if aList = nil then if aList = nil then
exit; exit;
PGtkCellRenderer(aList[0].data)^.get_padding(@xpad, @ypad); PGtkCellRenderer(g_list_nth_data(aList, 0))^.get_padding(@xpad, @ypad);
g_free(aList); g_list_free(aList);
GetStyleContextSizes(aCombo^.priv3^.button, ABorder, AMargin, APadding, w, h); GetStyleContextSizes(aCombo^.priv3^.button, ABorder, AMargin, APadding, w, h);
aContext := PGtkCellView(ACombo^.priv3^.cell_view)^.get_pango_context; aContext := PGtkCellView(ACombo^.priv3^.cell_view)^.get_pango_context;
@ -123,6 +123,7 @@ begin
min_height^ := h + ABorder.Top + ABorder.Bottom + AMargin.Top + AMargin.Bottom + APadding.Top + APadding.Bottom + (ypad * 2); min_height^ := h + ABorder.Top + ABorder.Bottom + AMargin.Top + AMargin.Bottom + APadding.Top + APadding.Bottom + (ypad * 2);
if Assigned(nat_height) then if Assigned(nat_height) then
nat_height^ := min_height^; nat_height^ := min_height^;
aPangoLayout^.unref;
end; end;
exit; // keep gtk calculated height. exit; // keep gtk calculated height.
end; end;