Generated bindings for Gtk::Popover#pointing_to= is:
def pointing_to=(rect : Gdk::Rectangle?) : Nil
# gtk_popover_set_pointing_to: (Method | Setter)
# @rect: (nullable)
# Returns: (transfer none)
# Generator::NullableArrayPlan
rect = if rect.nil?
Pointer(Void).null
else
rect.to_unsafe
end
# C call
LibGtk.gtk_popover_set_pointing_to(to_unsafe, rect)
# Return value handling
end
This compiles but doesn't work, type of rect in else still a union, the problem is caused by the reuse of the rect variable, if I change it to something else it works.
Monkey patch to fix that:
class Popover
def pointing_to=(rect : Gdk::Rectangle?) : Nil
rect_ptr = if rect.nil?
Pointer(Void).null
else
rect.to_unsafe
end
LibGtk.gtk_popover_set_pointing_to(to_unsafe, rect_ptr)
end
end
Generated bindings for
Gtk::Popover#pointing_to=
is:This compiles but doesn't work, type of
rect
inelse
still a union, the problem is caused by the reuse of therect
variable, if I change it to something else it works.Monkey patch to fix that: