Re: gir and refcounting



My first thought is that Perl and Glib::Object::Introspection is just fine.
If I were you, I would further debug my own application, with something
like refdbg (http://refdbg.sourceforge.net/ despite the looks, it still
works nowadays) or GObject-list (https://github.com/danni/gobject-list
haven’t tried it myself, but it got pretty good feedback).

Best,
Gergely

On 2 January 2015 at 12:24, Wouter Verhelst <w uter be> wrote:

Hi,

After help on this list, I got my API documentation to work properly,
and have since added GObject-Introspection annotations so that I could
use it from perl.

When running the following script:

---
use Glib::Object::Introspection;

Glib::Object::Introspection->setup(
        basename => "Joy",
        version => "1.0",
        package => "Joy");

my $stick = Joy::Stick->open("/dev/input/js0");
if(!$stick->get("open")) {
        print("Joystick could not be opened.\n");
        exit 0;
}
print "Joystick " . $stick->describe() . " has " .
$stick->get_button_count() . " buttons and " . $stick->get_axis_count() . "
axes\n";
---

then the output is:

Joystick Logitech Inc. WingMan Gamepad Extreme has 10 buttons and 4 axes
GLib-GObject-CRITICAL **: g_object_get_qdata: assertion 'G_IS_OBJECT
(object)' failed during global destruction.
GLib-GObject-CRITICAL **: g_object_steal_qdata: assertion 'G_IS_OBJECT
(object)' failed during global destruction.
GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)'
failed during global destruction.

(or, when no joystick is present:)

Joystick could not be opened.
GLib-GObject-CRITICAL **: g_object_get_qdata: assertion 'G_IS_OBJECT
(object)' failed during global destruction.
GLib-GObject-CRITICAL **: g_object_steal_qdata: assertion 'G_IS_OBJECT
(object)' failed during global destruction.
GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)'
failed during global destruction.

This occurs because somehow, perl seems to have a higher reference count
than does glib, causing it to deref the object when it's already been
destroyed. I've been trying to figure out what the problem is, but so
far without luck.

Anyone know what's happening?

Code is at https://github.com/yoe/libjoy

Thanks,

--
It is easy to love a country that is famous for chocolate and beer

  -- Barack Obama, speaking in Brussels, Belgium, 2014-03-26
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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