# Terminated Ruby object passed to notify signal callback

**URL:** <https://www.ruby-forum.com/t/terminated-ruby-object-passed-to-notify-signal-callback/242805>\
**Category:** Ruby-Gnome 2\
**Created:** [July 29, 2015, 5:58pm UTC](https://www.ruby-forum.com/t/terminated-ruby-object-passed-to-notify-signal-callback/242805 "2015-07-29T17:58:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [July 29, 2015, 5:58pm UTC](https://www.ruby-forum.com/t/terminated-ruby-object-passed-to-notify-signal-callback/242805/1 "2015-07-29T17:58:45Z")

</div>

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
