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



10.04.2015, 15:28, "Yuri Myasoedov" <ymyasoedov yandex ru>:
10.04.2015, 11:01, "Torsten Schönfeld" <kaffeetisch gmx de>:
 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).

Yes, there is no "allow-none" in "screen_changed" vfunc. BTW, it seems "allow-none" is depricated since GI 
1.42 (see https://wiki.gnome.org/Projects/GObjectIntrospection/Annotations) and should be replaced by 
(nullable) and (optional).
 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?

It seems the first one is the right way, and the second one is the fast way.

I've tried to fix Gtk-3.0.gir and rebuilt it with g-ir-compiler. I added "allow-none" to vfuncs 
"signal_changed", "style_set" and then I got a segfault on method "adjust_size_request". I've attached full 
backtrace if it could help to locate the issue.
But I still can't understand, why I need to reimplement methods PARENT_SET, HIERARCHY_CHANGED, EVENT, 
otherwise my code fails with an error like "Can't locate object method "PARENT_SET" via package "MyButton" at 
/usr/local/lib/x86_64-linux-gnu/perl/5.20.1/Glib/Object/Introspection.pm line 58". Something is wrong with 
that.

Attachment: bt.zip
Description: Zip archive



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