Re: Problem with subclassing with Glib::Object::Subclass and Gtk3

"Yuri Myasoedov" <ymyasoedov yandex ru>:
Hm. It seems the problem is in Glib::Object::Introspection XS function _invoke_fallback_vfunc:


It can't handle undef parameters. For example, in "screen-changed" handler (I didn't connect any handlers 
to this signal in my class):

void user_function (GtkWidget *widget, GdkScreen *previous_screen, gpointer   user_data)

where "previous_screen" -- the previous screen, or NULL if the widget was not associated with a screen 

In my case "previous_screen" is undef because it should be NULL in C. But Glib::Object::Introspection 
requires that "previous_screen" should be Gtk3::Gdk::Screen and it fails when "previous_screen" is undef: 
"undef is not of type Gtk3::Gdk::Screen".

To avoid segfaults, Glib::Object::Introspection disallows undef for pointer arguments that are not marked as 
accepting NULL.  There is probably no "allow-none" annotation for the "previous_screen" argument of the 
"screen_changed" vfunc (check in <prefix>/share/gir-1.0/Gtk-3.0.gir).

There is support in gobject-introspection for applying annotations to a vfunc that come from its invoker:

But for "screen_changed" there does not seem to be an invoker, only a signal.  The signal does have the 
correct annotation:

So, one option would be to add support to gobject-introspection for applying annotations to a vfunc from its 
associated signal.  Another would be to suppress the undef-checking when invoking fallback vfuncs in 
Glib::Object::Introspection.  Suggestions?

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