summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authortsutsui <tsutsui@pkgsrc.org>2018-04-29 15:36:44 +0000
committertsutsui <tsutsui@pkgsrc.org>2018-04-29 15:36:44 +0000
commitbac9c4af7734f2e71abce11b70b3475098fc41ec (patch)
tree0880b50395cc6ea3ff74e9cf0fcd78df314d9f2d /devel
parentc172d3b7650d128b43d3eae15d251f658a81d8d3 (diff)
downloadpkgsrc-bac9c4af7734f2e71abce11b70b3475098fc41ec.tar.gz
ruby-gnome2-glib, ruby-gnome2-gtk: pull upstream fixes for issue #1162.
Fixes crashes on mikutter. Bump PKGREVISIONs.
Diffstat (limited to 'devel')
-rw-r--r--devel/ruby-gnome2-glib/Makefile3
-rw-r--r--devel/ruby-gnome2-glib/buildlink3.mk4
-rw-r--r--devel/ruby-gnome2-glib/distinfo10
-rw-r--r--devel/ruby-gnome2-glib/patches/patch-ext_glib2_glib2.def16
-rw-r--r--devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbglib.h17
-rw-r--r--devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobj__binding.c23
-rw-r--r--devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobj__closure.c48
-rw-r--r--devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobj__object.c176
-rw-r--r--devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobject.c114
-rw-r--r--devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobject.h28
-rw-r--r--devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgprivate.h22
11 files changed, 457 insertions, 4 deletions
diff --git a/devel/ruby-gnome2-glib/Makefile b/devel/ruby-gnome2-glib/Makefile
index e7b3789f324..5fe57635a91 100644
--- a/devel/ruby-gnome2-glib/Makefile
+++ b/devel/ruby-gnome2-glib/Makefile
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.30 2018/02/21 16:59:59 jperkin Exp $
+# $NetBSD: Makefile,v 1.31 2018/04/29 15:36:44 tsutsui Exp $
#
DISTNAME= glib2-${VERSION}
PKGNAME= ${RUBY_PKGPREFIX}-gnome2-glib-${VERSION}
+PKGREVISION= 1
COMMENT= Ruby binding of GLib-2.x
CATEGORIES= devel
diff --git a/devel/ruby-gnome2-glib/buildlink3.mk b/devel/ruby-gnome2-glib/buildlink3.mk
index a874e8f3f14..841cc087b1a 100644
--- a/devel/ruby-gnome2-glib/buildlink3.mk
+++ b/devel/ruby-gnome2-glib/buildlink3.mk
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.11 2014/03/14 12:45:49 obache Exp $
+# $NetBSD: buildlink3.mk,v 1.12 2018/04/29 15:36:44 tsutsui Exp $
BUILDLINK_TREE+= ruby-gnome2-glib
@@ -6,7 +6,7 @@ BUILDLINK_TREE+= ruby-gnome2-glib
RUBY_GNOME2_GLIB_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.ruby-gnome2-glib+= ${RUBY_PKGPREFIX}-gnome2-glib>=0.17.0
-BUILDLINK_ABI_DEPENDS.ruby-gnome2-glib+= ${RUBY_PKGPREFIX}-gnome2-glib>=2.2.0
+BUILDLINK_ABI_DEPENDS.ruby-gnome2-glib+= ${RUBY_PKGPREFIX}-gnome2-glib>=2.2.4nb1
BUILDLINK_PKGSRCDIR.ruby-gnome2-glib?= ../../devel/ruby-gnome2-glib
.include "../../devel/glib2/buildlink3.mk"
diff --git a/devel/ruby-gnome2-glib/distinfo b/devel/ruby-gnome2-glib/distinfo
index e8e905cd560..e0b7f920925 100644
--- a/devel/ruby-gnome2-glib/distinfo
+++ b/devel/ruby-gnome2-glib/distinfo
@@ -1,6 +1,14 @@
-$NetBSD: distinfo,v 1.14 2018/04/13 16:31:09 tsutsui Exp $
+$NetBSD: distinfo,v 1.15 2018/04/29 15:36:44 tsutsui Exp $
SHA1 (glib2-3.2.4.gem) = a1aa0ea0d88fe241825daee9f2a7e9a444cb60fe
RMD160 (glib2-3.2.4.gem) = f6b6da60e27bf9ebaee6757d0fa7df01b9dcb73e
SHA512 (glib2-3.2.4.gem) = d766787ad15ead3f0b8ff0a334fd0a8df5b6ea719fee36aa5c3aa38273d1e4ccfb1ceab4564b0c01e597a413a8e49009adf70a6ac27b930465a9aa7d8b033418
Size (glib2-3.2.4.gem) = 142336 bytes
+SHA1 (patch-ext_glib2_glib2.def) = 9f6e593c494930e28c683689d7438d14333377b8
+SHA1 (patch-ext_glib2_rbglib.h) = 97a9088fb749f0985d415ee068eceb1e78237661
+SHA1 (patch-ext_glib2_rbgobj__binding.c) = 1c6459564d08d86570ad631dbd95b20f9ff22ba5
+SHA1 (patch-ext_glib2_rbgobj__closure.c) = 6655f9a2e49f8bfd1eb0ec2208ab566d5d13b02e
+SHA1 (patch-ext_glib2_rbgobj__object.c) = c0099a33d3805d2137b1f76f8050bb1c075bfefa
+SHA1 (patch-ext_glib2_rbgobject.c) = 5e81544395ee1dc543ab5cf926ea19d1ade89431
+SHA1 (patch-ext_glib2_rbgobject.h) = 8023d86bc2d119f83d37c27e7686f6a55816616c
+SHA1 (patch-ext_glib2_rbgprivate.h) = 9cad0b23a174b500a940d5d1fa4d66a6aeac3566
diff --git a/devel/ruby-gnome2-glib/patches/patch-ext_glib2_glib2.def b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_glib2.def
new file mode 100644
index 00000000000..9dbb3ebf3e8
--- /dev/null
+++ b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_glib2.def
@@ -0,0 +1,16 @@
+$NetBSD: patch-ext_glib2_glib2.def,v 1.1 2018/04/29 15:36:44 tsutsui Exp $
+
+- pull upstream fix for issue #1162
+
+--- ext/glib2/glib2.def.orig 2018-04-29 15:03:29.000000000 +0000
++++ ext/glib2/glib2.def
+@@ -61,6 +61,9 @@ EXPORTS
+ rbgobj_class_init_func
+ rbgobj_register_type
+ rbgobj_object_alloc_func
++ rbgobj_object_add_relative
++ rbgobj_object_remove_relative
++ rbgobj_object_remove_relatives
+ rbgobj_set_signal_func
+ rbgobj_get_signal_func
+ rbgobj_set_signal_call_func
diff --git a/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbglib.h b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbglib.h
new file mode 100644
index 00000000000..dcc200fe5c7
--- /dev/null
+++ b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbglib.h
@@ -0,0 +1,17 @@
+$NetBSD: patch-ext_glib2_rbglib.h,v 1.1 2018/04/29 15:36:44 tsutsui Exp $
+
+- pull upstream fix for issue #1162
+
+--- ext/glib2/rbglib.h.orig 2018-04-29 15:03:29.000000000 +0000
++++ ext/glib2/rbglib.h
+@@ -46,6 +46,10 @@ extern "C" {
+ # endif
+ #endif
+
++#ifndef RB_ALLOC
++# define RB_ALLOC(type) ALLOC(type)
++#endif
++
+ #ifndef RB_ALLOC_N
+ # define RB_ALLOC_N(type, n) ALLOC_N(type, n)
+ #endif
diff --git a/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobj__binding.c b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobj__binding.c
new file mode 100644
index 00000000000..973de67988b
--- /dev/null
+++ b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobj__binding.c
@@ -0,0 +1,23 @@
+$NetBSD: patch-ext_glib2_rbgobj__binding.c,v 1.1 2018/04/29 15:36:44 tsutsui Exp $
+
+- pull upstream fix for issue #1162
+
+--- ext/glib2/rbgobj_binding.c.orig 2018-04-29 15:03:30.000000000 +0000
++++ ext/glib2/rbgobj_binding.c
+@@ -28,7 +28,15 @@
+ static VALUE
+ rg_unbind(VALUE self)
+ {
+- g_binding_unbind(_SELF(self));
++ GBinding *binding = _SELF(self);
++ GObject *source;
++ VALUE rb_source;
++
++ source = g_binding_get_source(binding);
++ rb_source = GOBJ2RVAL(source);
++ rbgobj_object_remove_relative(rb_source, self);
++ g_binding_unbind(binding);
++
+ return self;
+ }
+ #endif
diff --git a/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobj__closure.c b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobj__closure.c
new file mode 100644
index 00000000000..6833736cfcc
--- /dev/null
+++ b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobj__closure.c
@@ -0,0 +1,48 @@
+$NetBSD: patch-ext_glib2_rbgobj__closure.c,v 1.1 2018/04/29 15:36:44 tsutsui Exp $
+
+- pull upstream fix for issue #1162
+
+--- ext/glib2/rbgobj_closure.c.orig 2018-04-29 15:03:30.000000000 +0000
++++ ext/glib2/rbgobj_closure.c
+@@ -1,6 +1,6 @@
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
+ /*
+- * Copyright (C) 2011-2016 Ruby-GNOME2 Project Team
++ * Copyright (C) 2011-2018 Ruby-GNOME2 Project Team
+ * Copyright (C) 2002-2006 Ruby-GNOME2 Project
+ * Copyright (C) 2002,2003 Masahiro Sakai
+ *
+@@ -191,8 +191,9 @@ rclosure_invalidate(G_GNUC_UNUSED gpoint
+ for (next = rclosure->objects; next; next = next->next) {
+ GObject *object = G_OBJECT(next->data);
+ VALUE obj = rbgobj_ruby_object_from_instance2(object, FALSE);
+- if (!NIL_P(rclosure->rb_holder) && !NIL_P(obj))
+- G_REMOVE_RELATIVE(obj, id_closures, rclosure->rb_holder);
++ if (!NIL_P(rclosure->rb_holder) && !NIL_P(obj)) {
++ rbgobj_object_remove_relative(obj, rclosure->rb_holder);
++ }
+ }
+
+ rclosure_unref(rclosure);
+@@ -286,16 +287,15 @@ rclosure_weak_notify(gpointer data, GObj
+ void
+ g_rclosure_attach(GClosure *closure, VALUE object)
+ {
+- static VALUE mGLibObject = (VALUE)NULL;
++ static VALUE cGLibObject = Qnil;
+ GRClosure *rclosure = (GRClosure *)closure;
+
+- G_RELATIVE2(object, Qnil, id_closures, rclosure->rb_holder);
+-
+- if (!mGLibObject) {
+- mGLibObject = rb_const_get(mGLib, rb_intern("Object"));
++ if (NIL_P(cGLibObject)) {
++ cGLibObject = rb_const_get(mGLib, rb_intern("Object"));
+ }
+- if (rb_obj_is_kind_of(object, mGLibObject)) {
++ if (rb_obj_is_kind_of(object, cGLibObject)) {
+ GObject *gobject;
++ rbgobj_object_add_relative(object, rclosure->rb_holder);
+ gobject = RVAL2GOBJ(object);
+ rclosure->count++;
+ g_object_weak_ref(gobject, rclosure_weak_notify, rclosure);
diff --git a/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobj__object.c b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobj__object.c
new file mode 100644
index 00000000000..b7cb3d23678
--- /dev/null
+++ b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobj__object.c
@@ -0,0 +1,176 @@
+$NetBSD: patch-ext_glib2_rbgobj__object.c,v 1.1 2018/04/29 15:36:44 tsutsui Exp $
+
+- pull upstream fix for issue #1162
+
+--- ext/glib2/rbgobj_object.c.orig 2018-04-29 15:03:30.000000000 +0000
++++ ext/glib2/rbgobj_object.c
+@@ -43,7 +43,8 @@ weak_notify(gpointer data, G_GNUC_UNUSED
+ gobj_holder *holder = data;
+
+ rbgobj_instance_call_cinfo_free(holder->gobj);
+- rbgobj_invalidate_relatives(holder->self);
++ g_hash_table_unref(holder->rb_relatives);
++ holder->rb_relatives = NULL;
+ holder->destroyed = TRUE;
+
+ g_object_unref(holder->gobj);
+@@ -51,11 +52,24 @@ weak_notify(gpointer data, G_GNUC_UNUSED
+ }
+
+ static void
++holder_relatives_mark(gpointer key, gpointer value, gpointer user_data)
++{
++ VALUE rb_relative = (VALUE)value;
++ rb_gc_mark(rb_relative);
++}
++
++static void
+ holder_mark(void *data)
+ {
+ gobj_holder *holder = data;
+- if (holder->gobj && !holder->destroyed)
+- rbgobj_instance_call_cinfo_mark(holder->gobj);
++
++ if (!holder->gobj)
++ return;
++ if (holder->destroyed)
++ return;
++
++ rbgobj_instance_call_cinfo_mark(holder->gobj);
++ g_hash_table_foreach(holder->rb_relatives, holder_relatives_mark, NULL);
+ }
+
+ static void
+@@ -91,6 +105,59 @@ static const rb_data_type_t rg_glib_obje
+ RUBY_TYPED_FREE_IMMEDIATELY,
+ };
+
++void
++rbgobj_object_add_relative(VALUE rb_gobject, VALUE rb_relative)
++{
++ gobj_holder *holder;
++ TypedData_Get_Struct(rb_gobject,
++ gobj_holder,
++ &rg_glib_object_type,
++ holder);
++ if (holder->rb_relatives) {
++ g_hash_table_insert(holder->rb_relatives,
++ (gpointer)(rb_relative),
++ (gpointer)(rb_relative));
++ }
++}
++
++void
++rbgobj_object_remove_relative(VALUE rb_gobject, VALUE rb_relative)
++{
++ gobj_holder *holder;
++ TypedData_Get_Struct(rb_gobject,
++ gobj_holder,
++ &rg_glib_object_type,
++ holder);
++ if (holder->rb_relatives) {
++ g_hash_table_remove(holder->rb_relatives,
++ (gpointer)(rb_relative));
++ }
++}
++
++static gboolean
++rbgobj_object_remove_relatives_body(gpointer key,
++ gpointer value,
++ gpointer user_data)
++{
++ VALUE rb_relative = (VALUE)value;
++ VALUE rb_relative_class = (VALUE)user_data;
++
++ return RVAL2CBOOL(rb_obj_is_kind_of(rb_relative, rb_relative_class));
++}
++
++void
++rbgobj_object_remove_relatives(VALUE rb_gobject, VALUE rb_relative_class)
++{
++ gobj_holder *holder;
++ TypedData_Get_Struct(rb_gobject,
++ gobj_holder,
++ &rg_glib_object_type,
++ holder);
++ g_hash_table_foreach_remove(holder->rb_relatives,
++ rbgobj_object_remove_relatives_body,
++ (gpointer)(rb_relative_class));
++}
++
+ VALUE
+ rbgobj_object_alloc_func(VALUE klass)
+ {
+@@ -105,6 +172,7 @@ rbgobj_object_alloc_func(VALUE klass)
+ holder->gobj = NULL;
+ holder->cinfo = NULL;
+ holder->destroyed = FALSE;
++ holder->rb_relatives = g_hash_table_new(g_direct_hash, g_direct_equal);
+
+ return result;
+ }
+@@ -686,13 +754,6 @@ static void
+ rg_destroy_bind_property_full_data(gpointer user_data)
+ {
+ RGBindPropertyCallbackData *data = (RGBindPropertyCallbackData *)user_data;
+-
+- if (!NIL_P(data->transform_to_callback))
+- G_CHILD_REMOVE(data->self, data->transform_to_callback);
+-
+- if (!NIL_P(data->transform_from_callback))
+- G_CHILD_REMOVE(data->self, data->transform_from_callback);
+-
+ xfree(data);
+ }
+
+@@ -715,6 +776,7 @@ rg_bind_property(gint argc, VALUE *argv,
+ GBinding *binding;
+ GBindingTransformFunc transform_to = NULL;
+ GBindingTransformFunc transform_from = NULL;
++ VALUE rb_binding;
+
+ rb_scan_args(argc, argv, "41", &rb_source_property, &rb_target,
+ &rb_target_property, &rb_flags, &rb_options);
+@@ -731,18 +793,16 @@ rg_bind_property(gint argc, VALUE *argv,
+ flags = RVAL2GBINDINGFLAGS(rb_flags);
+
+ if (!NIL_P(rb_transform_to)) {
+- G_CHILD_ADD(self, rb_transform_to);
+ transform_to = rg_bind_property_transform_to_callback;
+ }
+
+ if (!NIL_P(rb_transform_from)) {
+- G_CHILD_ADD(self, rb_transform_from);
+ transform_from = rg_bind_property_transform_from_callback;
+ }
+
+ if (transform_to || transform_from) {
+ RGBindPropertyCallbackData *data;
+- data = (RGBindPropertyCallbackData *)xmalloc(sizeof(RGBindPropertyCallbackData));
++ data = RB_ALLOC(RGBindPropertyCallbackData);
+ data->self = self;
+ data->transform_to_callback = rb_transform_to;
+ data->transform_from_callback = rb_transform_from;
+@@ -752,13 +812,21 @@ rg_bind_property(gint argc, VALUE *argv,
+ transform_from,
+ (gpointer)data,
+ rg_destroy_bind_property_full_data);
++ rb_binding = GOBJ2RVAL(binding);
++ if (!NIL_P(rb_transform_to)) {
++ rbgobj_object_add_relative(rb_binding, rb_transform_to);
++ }
++ if (!NIL_P(rb_transform_from)) {
++ rbgobj_object_add_relative(rb_binding, rb_transform_from);
++ }
+ } else {
+ binding = g_object_bind_property(source, source_property,
+ target, target_property,
+ flags);
++ rb_binding = GOBJ2RVAL(binding);
+ }
+
+- return GOBJ2RVAL(binding);
++ return rb_binding;
+ }
+ #endif
+
diff --git a/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobject.c b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobject.c
new file mode 100644
index 00000000000..13ece725e06
--- /dev/null
+++ b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobject.c
@@ -0,0 +1,114 @@
+$NetBSD: patch-ext_glib2_rbgobject.c,v 1.1 2018/04/29 15:36:44 tsutsui Exp $
+
+- pull upstream fix for issue #1162
+
+--- ext/glib2/rbgobject.c.orig 2018-04-29 15:03:30.000000000 +0000
++++ ext/glib2/rbgobject.c
+@@ -1,6 +1,6 @@
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
+ /*
+- * Copyright (C) 2011 Ruby-GNOME2 Project Team
++ * Copyright (C) 2011-2018 Ruby-GNOME2 Project Team
+ * Copyright (C) 2003-2006 Ruby-GNOME2 Project Team
+ * Copyright (C) 2002,2003 Masahiro Sakai
+ * Copyright (C) 1998-2000 Yukihiro Matsumoto,
+@@ -183,16 +183,25 @@ rbgobj_ruby_object_from_instance_with_un
+ void
+ rbgobj_add_relative(VALUE obj, VALUE relative)
+ {
+- VALUE hash = Qnil;
++ static VALUE mGLibObject = Qnil;
++ if (NIL_P(mGLibObject)) {
++ mGLibObject = rb_const_get(mGLib, rb_intern("Object"));
++ }
+
+- if (RVAL2CBOOL(rb_ivar_defined(obj, id_relatives)))
+- hash = rb_ivar_get(obj, id_relatives);
++ if (rb_obj_is_kind_of(obj, mGLibObject)) {
++ rbgobj_object_add_relative(obj, relative);
++ } else {
++ VALUE hash = Qnil;
+
+- if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) {
+- hash = rb_hash_new();
+- rb_ivar_set(obj, id_relatives, hash);
++ if (RVAL2CBOOL(rb_ivar_defined(obj, id_relatives)))
++ hash = rb_ivar_get(obj, id_relatives);
++
++ if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) {
++ hash = rb_hash_new();
++ rb_ivar_set(obj, id_relatives, hash);
++ }
++ rb_hash_aset(hash, relative, Qnil);
+ }
+- rb_hash_aset(hash, relative, Qnil);
+ }
+
+ void
+@@ -207,16 +216,26 @@ rbgobj_invalidate_relatives(VALUE obj)
+ void
+ rbgobj_add_relative_removable(VALUE obj, VALUE relative, ID obj_ivar_id, VALUE hash_key)
+ {
+- VALUE hash = Qnil;
++ static VALUE cGLibObject = Qnil;
++ if (NIL_P(cGLibObject)) {
++ cGLibObject = rb_const_get(mGLib, rb_intern("Object"));
++ }
+
+- if (RVAL2CBOOL(rb_ivar_defined(obj, obj_ivar_id)))
+- hash = rb_ivar_get(obj, obj_ivar_id);
++ if (obj_ivar_id == rbgobj_id_children &&
++ rb_obj_is_kind_of(obj, cGLibObject)) {
++ rbgobj_object_add_relative(obj, hash_key);
++ } else {
++ VALUE hash = Qnil;
+
+- if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) {
+- hash = rb_hash_new();
+- rb_ivar_set(obj, obj_ivar_id, hash);
++ if (RVAL2CBOOL(rb_ivar_defined(obj, obj_ivar_id)))
++ hash = rb_ivar_get(obj, obj_ivar_id);
++
++ if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) {
++ hash = rb_hash_new();
++ rb_ivar_set(obj, obj_ivar_id, hash);
++ }
++ rb_hash_aset(hash, hash_key, relative);
+ }
+- rb_hash_aset(hash, hash_key, relative);
+ }
+
+ VALUE
+@@ -236,15 +255,25 @@ rbgobj_get_relative_removable(VALUE obj,
+ void
+ rbgobj_remove_relative(VALUE obj, ID obj_ivar_id, VALUE hash_key)
+ {
+- VALUE hash = Qnil;
+-
+- if (RVAL2CBOOL(rb_ivar_defined(obj, obj_ivar_id)))
+- hash = rb_ivar_get(obj, obj_ivar_id);
++ static VALUE cGLibObject = Qnil;
++ if (NIL_P(cGLibObject)) {
++ cGLibObject = rb_const_get(mGLib, rb_intern("Object"));
++ }
+
+- if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) {
+- /* should not happen. */
++ if ((obj_ivar_id == id_relatives || obj_ivar_id == rbgobj_id_children) &&
++ rb_obj_is_kind_of(obj, cGLibObject)) {
++ rbgobj_object_remove_relative(obj, hash_key);
+ } else {
+- rb_funcall(hash, id_delete, 1, hash_key);
++ VALUE hash = Qnil;
++
++ if (RVAL2CBOOL(rb_ivar_defined(obj, obj_ivar_id)))
++ hash = rb_ivar_get(obj, obj_ivar_id);
++
++ if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) {
++ /* should not happen. */
++ } else {
++ rb_funcall(hash, id_delete, 1, hash_key);
++ }
+ }
+ }
+
diff --git a/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobject.h b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobject.h
new file mode 100644
index 00000000000..516c318ecd3
--- /dev/null
+++ b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgobject.h
@@ -0,0 +1,28 @@
+$NetBSD: patch-ext_glib2_rbgobject.h,v 1.1 2018/04/29 15:36:44 tsutsui Exp $
+
+- pull upstream fix for issue #1162
+
+--- ext/glib2/rbgobject.h.orig 2018-04-29 15:03:30.000000000 +0000
++++ ext/glib2/rbgobject.h
+@@ -79,6 +79,7 @@ RUBY_GLIB2_VAR ID rbgobj_id_children;
+ (rbgobj_add_relative_removable(self, Qnil, rbgobj_id_children, child))
+ #define G_CHILD_REMOVE(self, child) \
+ (rbgobj_remove_relative(self, rbgobj_id_children, child))
++/* Deprecated since 3.2.5. Use rbobj_object_remove_relatives() instead. */
+ #define G_CHILD_REMOVE_ALL(self) \
+ (rbgobj_remove_relative_all(self, rbgobj_id_children))
+
+@@ -147,6 +148,13 @@ extern VALUE rbgobj_ruby_object_from_ins
+ extern VALUE rbgobj_ruby_object_from_instance_with_unref(gpointer instance);
+ extern void rbgobj_instance_unref(gpointer instance);
+
++extern void rbgobj_object_add_relative(VALUE rb_gobject,
++ VALUE rb_relative);
++extern void rbgobj_object_remove_relative(VALUE rb_gobject,
++ VALUE rb_relative);
++extern void rbgobj_object_remove_relatives(VALUE rb_gobject,
++ VALUE rb_relative_class);
++
+ extern void rbgobj_add_relative(VALUE obj, VALUE relative);
+ extern void rbgobj_invalidate_relatives(VALUE obj);
+ extern void rbgobj_add_relative_removable(VALUE obj, VALUE relative,
diff --git a/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgprivate.h b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgprivate.h
new file mode 100644
index 00000000000..5c4e0c546fa
--- /dev/null
+++ b/devel/ruby-gnome2-glib/patches/patch-ext_glib2_rbgprivate.h
@@ -0,0 +1,22 @@
+$NetBSD: patch-ext_glib2_rbgprivate.h,v 1.1 2018/04/29 15:36:44 tsutsui Exp $
+
+- pull upstream fix for issue #1162
+
+--- ext/glib2/rbgprivate.h.orig 2018-04-29 15:03:30.000000000 +0000
++++ ext/glib2/rbgprivate.h
+@@ -1,6 +1,6 @@
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
+ /*
+- * Copyright (C) 2007-2017 Ruby-GNOME2 Project Team
++ * Copyright (C) 2007-2018 Ruby-GNOME2 Project Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+@@ -42,6 +42,7 @@ typedef struct {
+ GObject* gobj;
+ const RGObjClassInfo* cinfo;
+ gboolean destroyed;
++ GHashTable *rb_relatives;
+ } gobj_holder;
+
+ typedef struct {