Re: Python pointers in python-gi ?



Op 11-03-18 om 09:55 schreef Christoph Reiter:
On Sun, Mar 11, 2018 at 1:47 AM, Reuben Rissler <silrep emypeople net> wrote:
This email is thoroughly explained by :

https://stackoverflow.com/questions/49213440/how-does-one-call-gdk-frame-clock-get-refresh-info-from-python


As far as I can tell, when python-gi passes in a variable to a C function
which uses pointers, the Python program segfaults. The exact same problem
happens when using GtkSpinbutton input/output signals. What would be
required to fix or workaround this?
The function is missing annotations for the last two parameters.
Please file a bug with pygobject or gtk.
_______________________________________________


If I understood the annotation docs correctly this would then be:

@refresh_interval_return: (out) (nullable): text
@presentation_time_return: (out) (not nullable): text

Right? If so then see below patch.

@Reuben let me know the bug number and I'll post the patch there for review.

~infirit

diff --git a/gdk/gdkframeclock.c b/gdk/gdkframeclock.c
index a1f20c40e9..18e957d5b0 100644
--- a/gdk/gdkframeclock.c
+++ b/gdk/gdkframeclock.c
@@ -537,11 +537,11 @@ _gdk_frame_clock_debug_print_timings
(GdkFrameClock   *clock,
  * gdk_frame_clock_get_refresh_info:
  * @frame_clock: a #GdkFrameClock
  * @base_time: base time for determining a presentaton time
- * @refresh_interval_return: a location to store the determined refresh
- *  interval, or %NULL. A default refresh interval of 1/60th of
- *  a second will be stored if no history is present.
- * @presentation_time_return: a location to store the next
- *  candidate presentation time after the given base time.
+ * @refresh_interval_return: (out) (nullable): a location to store the
+ * determined refresh interval, or %NULL. A default refresh interval of
+ * 1/60th of a second will be stored if no history is present.
+ * @presentation_time_return: (out) (not nullable): a location to store
+ * the next candidate presentation time after the given base time.
  *  0 will be will be stored if no history is present.
  *
  * Using the frame history stored in the frame clock, finds the last




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]