Cant call gsk_path_get_closest_point
Calling this fn returns
Traceback (most recent call last):
File "/var/home/deathwish/Downloads/test/test.py", line 23, in on_activate
crash()
File "/var/home/deathwish/Downloads/test/test.py", line 18, in crash
_found, end, _end_d = path.get_closest_point(p, 5)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Could not caller allocate argument 3 of callable Gsk.Path.get_closest_point
A simple reproducer
#!/usr/bin/env python3
import gi
gi.require_version("Gtk", "4.0")
from gi.repository import Gtk, GObject, Gio, GLib, Graphene, Gsk
def crash():
path_builder = Gsk.PathBuilder.new()
path_builder.line_to(0, 1)
path_builder.line_to(1, 1)
path_builder.line_to(1, 0)
path_builder.close()
path = path_builder.to_path()
p = Graphene.Point().alloc()
p.init(2, 0)
_found, end, _end_d = path.get_closest_point(p, 5)
def on_activate(app):
window = Gtk.ApplicationWindow(application=app)
window.present()
crash()
app = Gtk.Application()
app.connect("activate", on_activate)
app.run()
Here is the definition of the fn
/**
* gsk_path_get_closest_point:
* @self: a `GskPath`
* @point: the point
* @threshold: maximum allowed distance
* @result: (out caller-allocates): return location for the closest point
* @distance: (out) (optional): return location for the distance
*
* Computes the closest point on the path to the given point
* and sets the @result to it.
*
* If there is no point closer than the given threshold,
* `FALSE` is returned.
*
* Returns: `TRUE` if @point was set to the closest point
* on @self, `FALSE` if no point is closer than @threshold
*
* Since: 4.14
*/
gboolean
gsk_path_get_closest_point (GskPath *self,
const graphene_point_t *point,
float threshold,
GskPathPoint *result,
float *distance)
and
G_DEFINE_BOXED_TYPE (GskPathPoint, gsk_path_point,
gsk_path_point_copy,
gsk_path_point_free)