Forum: Ruby-Gnome 2 Terminated Ruby object passed to notify signal callback

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
3de456c74add84bab7455247fbad3c7b?d=identicon&s=25 Bill Brown (cwb_4848)
on 2015-07-29 17:58
I'm using signal_connect('notify') on a bunch of Gtk::Label instances,
each wrapped in an EventBox. Sporadically, the callback fails because
the GLib::Param passed as the second parameter to the callback is a
terminated Ruby object. This results in a message concerning calling
"method_missing" on the terminated object and reporting that the class
is 0x0, followed by Ruby crashing with a segmentation fault.

If I test that the GLib::Param is among the objects known by ObjectSpace
and ignore the callback if it isn't (a very time-consuming test, by the
way), then the program proceeds. Often, a second or third bad callback
is seen among the hundreds of widgets created.

UPDATE: The widget passed to the callback is the EventBox and it has not
been destroyed.

For a specific configuration of my program, it is the same
Gtk::Label/Gtk::EventBox that is involved, but for different
configurations (meaning the Gtk::Label/Gtk::EventBox objects may be
created in different numbers and in different orders), a different
instance sees the error.

It seems like it might be that the Nth widget created has the problem,
for N somewhere in the hundreds. It seems plausible that GC was run just
before the problem occurs, but I have no proof.

Relevant library versions:
libglib2.0-0: 2.40.2-0ubuntu
ruby-glib2:   2.1.0-1
ruby-gtk2:    2.1.0-1

Ruby interpreter: 1:
This topic is locked and can not be replied to.