Terminated Ruby object passed to notify signal callback


#1

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:1.9.3.4