[Lazarus] For issue #31638 (gtk2 function that require free mem)

Alexey aaa5500 at ya.ru
Thu Apr 20 06:47:29 CEST 2017


+      if Assigned(Path) then
+      begin
+        AStr := gtk_tree_path_to_string(path);
+        AIsSet := (StrToInt(AStr) = AIndex);
+        if AStr <> nil then
+          g_free(AStr);
+        if Path <> nil then
+          gtk_tree_path_free(Path);
+        Result := True;
+      end;

1- not need in last check "if Path<>nil", checked before
2- better StrToIntDef(AStr, -1) to not give exception
(cannot comment there.)

Alexey


More information about the Lazarus mailing list