Re: Passing a GObjectClass into a function (with GooCanvas2)



On 2017-10-02 at 14:03:33 +0200, Torsten Schoenfeld wrote:
On 01.10.2017 23:12, Zakariyya Mughal wrote:
In case it helps, I noticed that that GIR XML differs in that
`gtk_container_class_list_child_properties` specifies a <method> but
`goo_canvas_item_class_list_child_properties` specifies a <function>.

That case was indeed not handled.  gtk+ represents the class struct
function as a method of the class struct, whereas goocanvas uses a
function of the object/interface from the class struct.

Please try again with this change:
<https://git.gnome.org/browse/perl-Glib-Object-Introspection/commit/?id=ac5409fff68705e144a16f973cce0e180dae1f6a>.

This change does fix the issue, but seems to have uncovered another
issue:

Using `GooCanvas2::CanvasItem::class_list_child_properties` works:

    perl -MGlib::Object::Introspection -MData::Dumper \
        -E 'Glib::Object::Introspection->setup( basename => "GooCanvas", version => "2.0", package => 
"GooCanvas2" );
        my @p = GooCanvas2::CanvasItem::class_list_child_properties( "GooCanvas2::CanvasTable" );
        say Dumper @p'

gives

    $VAR1 = [
              bless( {
                       'type' => 'Glib::Double',
                       'owner_type' => 'GooCanvas2::CanvasTable',
                       'flags' => bless( do{\(my $o = 3)}, 'Glib::ParamFlags' ),
                       'name' => 'left-padding',
                       'descr' => 'Extra space to add to the left of the item'
                     }, 'Glib::Param::Double' ),
    [...snip...]

but using `GooCanvas2::CanvasItemModel::class_list_child_properties` does
not:

    perl -MGlib::Object::Introspection -MData::Dumper \
        -E 'Glib::Object::Introspection->setup( basename => "GooCanvas", version => "2.0", package => 
"GooCanvas2" );
        my @p = GooCanvas2::CanvasItemModel::class_list_child_properties( "GooCanvas2::CanvasTableModel" );
        say Dumper @p'

gives

    GLib-GObject-CRITICAL **: g_param_spec_ref: assertion 'G_IS_PARAM_SPEC (pspec)' failed at 
/home/zaki/perl5/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/x86_64-linux/Glib/Object/Introspection.pm 
line 67.
    GLib-GObject-CRITICAL **: g_param_spec_sink: assertion 'G_IS_PARAM_SPEC (pspec)' failed at 
/home/zaki/perl5/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/x86_64-linux/Glib/Object/Introspection.pm 
line 67.
    GLib-GObject-CRITICAL **: g_param_spec_get_name: assertion 'G_IS_PARAM_SPEC (pspec)' failed at 
/home/zaki/perl5/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/x86_64-linux/Glib/Object/Introspection.pm 
line 67.
    GLib-GObject-CRITICAL **: g_param_spec_get_blurb: assertion 'G_IS_PARAM_SPEC (pspec)' failed at 
/home/zaki/perl5/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/x86_64-linux/Glib/Object/Introspection.pm 
line 67.
    unhandled paramspec type (null), falling back to Glib::ParamSpec at 
/home/zaki/perl5/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/x86_64-linux/Glib/Object/Introspection.pm 
line 67.
    [...snip...]
    Bus error


I think it has to do with a possible bug in the GooCanvas annotations
where they specify the return type of `GParamSpec**` as having
`(element-type GObject.ParamSpec)` despite the return type not using a
container type like `GSList*`. To compare, see:

- `goo_canvas_item_class_list_child_properties` 
<https://git.gnome.org/browse/goocanvas/tree/src/goocanvasitem.c?id=cd1ad0f66ded84901f77519434191ae108dadace#n2377>

- `goo_canvas_item_model_class_list_child_properties` 
<https://git.gnome.org/browse/goocanvas/tree/src/goocanvasitemmodel.c?id=cd1ad0f66ded84901f77519434191ae108dadace#n1155>

I recompiled GooCanvas without the `element-type` annotation on
`goo_canvas_item_model_class_list_child_properties` and the error
goes away. Perhaps the semantics of using `element-type` need to be
restricted or clarified?

Regards,
- Zaki Mughal

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


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