3

While trying to use GTK 3 frame clock in a Python 3 script, I discovered that I don't understand how to invoke the equivalent of gdk_frame_clock_get_refresh_info(). I have first tried the obvious, to call the get_refresh_info() method on the object returned by get_frame_clock():

from gi.repository import Gtk as gtk, GLib as glib

w = gtk.Window()
w.show()
glib.idle_add(lambda: print(w.get_frame_clock().get_refresh_info()))
gtk.main()

That fails with:

TypeError: Gdk.FrameClock.get_refresh_info() takes exactly 4 arguments (1 given)

The C function indeed takes four arguments, but the last two are pointers to gint64. In the Python version the function raises type errors when called with anything except three numbers. When invoked with three numbers, the whole process crashes with a segmentation fault.

Is this a bug in GDK's introspection specs for gdk_frame_clock_get_refresh_info? Is there a workaround, or a different way to obtain the refresh interval?

user4815162342
  • 141,790
  • 18
  • 296
  • 355
  • I believe this is the same problem as the GtkSpinbutton which uses pointers for input/output formatting, leading to seg faults. – theGtknerd Mar 11 '18 at 00:38
  • @theGtknerd Isn't this something that should have been taken care of at the level of gobject-introspection? – user4815162342 Mar 11 '18 at 00:45
  • It should... Do you have any knowledge of C, Python, and Gtk to push this forward? – theGtknerd Mar 11 '18 at 00:50
  • I posted on the [mailing list](https://mail.gnome.org/archives/python-hackers-list/2018-March/msg00001.html). – theGtknerd Mar 11 '18 at 01:04
  • @theGtknerd I know C and Python, but I don't think this is a C or Python issue. To me it looks like (most likely) a bug in gobject-introspection specs for `gdk_frame_clock_get_refresh_info` or (less likely) a bug in gobject-introspection and/or its Python bindings. – user4815162342 Mar 11 '18 at 06:42
  • Could you file the [bug report](https://mail.gnome.org/archives/python-hackers-list/2018-March/msg00002.html) they asked for on the mailing list? – theGtknerd Mar 11 '18 at 12:21
  • @theGtknerd Judging by [the followup](https://mail.gnome.org/archives/python-hackers-list/2018-March/msg00005.html), it seems the developers are already on it, thanks! Please remind them of the issues you've found with `GtkSpinButton`, which likely needs a similar change. – user4815162342 Mar 11 '18 at 17:25
  • @theGtknerd Thanks for your trouble. Would you like to write an answer explaining that this is a bug in the binding specs, so I can accept it? – user4815162342 Mar 11 '18 at 19:43

1 Answers1

2

This is a bug in the gobject-introspection binding specs. A proper bug report has been filed and is being worked on here.

user4815162342
  • 141,790
  • 18
  • 296
  • 355
theGtknerd
  • 3,647
  • 1
  • 13
  • 34