pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/devel/ruby-gnome2-gobject-introspection ruby-gnome2-go...
details: https://anonhg.NetBSD.org/pkgsrc/rev/797bff3a0b64
branches: trunk
changeset: 310156:797bff3a0b64
user: tsutsui <tsutsui%pkgsrc.org@localhost>
date: Fri Jul 06 18:15:40 2018 +0000
description:
ruby-gnome2-gobject-introspection: pull upstream fix for a memory leak.
diffstat:
devel/ruby-gnome2-gobject-introspection/Makefile | 3 +-
devel/ruby-gnome2-gobject-introspection/distinfo | 3 +-
devel/ruby-gnome2-gobject-introspection/patches/patch-ext_gobject-introspection_rb-gi-function-info.c | 123 ++++++++++
3 files changed, 127 insertions(+), 2 deletions(-)
diffs (153 lines):
diff -r 18583e00af7a -r 797bff3a0b64 devel/ruby-gnome2-gobject-introspection/Makefile
--- a/devel/ruby-gnome2-gobject-introspection/Makefile Fri Jul 06 16:24:04 2018 +0000
+++ b/devel/ruby-gnome2-gobject-introspection/Makefile Fri Jul 06 18:15:40 2018 +0000
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.7 2018/02/21 16:59:59 jperkin Exp $
+# $NetBSD: Makefile,v 1.8 2018/07/06 18:15:40 tsutsui Exp $
#
DISTNAME= gobject-introspection-${VERSION}
PKGNAME= ${RUBY_PKGPREFIX}-gnome2-${DISTNAME}
+PKGREVISION= 1
COMMENT= Ruby binding of Gobject Introspection
CATEGORIES= devel
diff -r 18583e00af7a -r 797bff3a0b64 devel/ruby-gnome2-gobject-introspection/distinfo
--- a/devel/ruby-gnome2-gobject-introspection/distinfo Fri Jul 06 16:24:04 2018 +0000
+++ b/devel/ruby-gnome2-gobject-introspection/distinfo Fri Jul 06 18:15:40 2018 +0000
@@ -1,6 +1,7 @@
-$NetBSD: distinfo,v 1.14 2018/06/09 03:36:07 tsutsui Exp $
+$NetBSD: distinfo,v 1.15 2018/07/06 18:15:40 tsutsui Exp $
SHA1 (gobject-introspection-3.2.7.gem) = 3652a8b491f0de7b8efcbf47ab7de0b8e0b2c8c4
RMD160 (gobject-introspection-3.2.7.gem) = 05004573c04cb8a41eaf71c50266c7311b7ee6a7
SHA512 (gobject-introspection-3.2.7.gem) = b51e4a06b49f946c53c1c638ce43a1a6b9acf0c4c986f4b8a84a5f77353473ba6b12616aab9d301dc17bb1d7a8876ffb78b01a0129e991768bbd0761d6725103
Size (gobject-introspection-3.2.7.gem) = 65536 bytes
+SHA1 (patch-ext_gobject-introspection_rb-gi-function-info.c) = 135099f0060aa693cd40c6674e48cbe088214c6c
diff -r 18583e00af7a -r 797bff3a0b64 devel/ruby-gnome2-gobject-introspection/patches/patch-ext_gobject-introspection_rb-gi-function-info.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/ruby-gnome2-gobject-introspection/patches/patch-ext_gobject-introspection_rb-gi-function-info.c Fri Jul 06 18:15:40 2018 +0000
@@ -0,0 +1,123 @@
+$NetBSD: patch-ext_gobject-introspection_rb-gi-function-info.c,v 1.3 2018/07/06 18:15:40 tsutsui Exp $
+
+- pull upstream fix for a memory leak
+ https://github.com/ruby-gnome2/ruby-gnome2/issues/1230
+ https://github.com/ruby-gnome2/ruby-gnome2/issues/1231
+
+--- ext/gobject-introspection/rb-gi-function-info.c.orig 2018-07-04 13:25:47.843178241 +0000
++++ ext/gobject-introspection/rb-gi-function-info.c
+@@ -46,6 +46,7 @@ struct RBGICallbackData_ {
+ RBGICallback *callback;
+ RBGIArgMetadata *metadata;
+ VALUE rb_callback;
++ VALUE rb_owner;
+ };
+
+ static VALUE RG_TARGET_NAMESPACE;
+@@ -304,18 +305,6 @@ fill_metadata(GPtrArray *args_metadata,
+ }
+
+ static void
+-callback_data_guard_from_gc(RBGICallbackData *callback_data)
+-{
+- rbg_gc_guard(callback_data, callback_data->rb_callback);
+-}
+-
+-static void
+-callback_data_unguard_from_gc(RBGICallbackData *callback_data)
+-{
+- rbg_gc_unguard(callback_data);
+-}
+-
+-static void
+ rb_gi_callback_free(RBGICallback *callback)
+ {
+ g_callable_info_free_closure(callback->callback_info,
+@@ -325,13 +314,28 @@ rb_gi_callback_free(RBGICallback *callba
+ xfree(callback);
+ }
+
++static void
++rb_gi_callback_data_weak_notify(gpointer data, GObject* where_the_object_was)
++{
++ RBGICallbackData *callback_data = data;
++ callback_data->rb_owner = Qnil;
++}
++
+ void
+ rb_gi_callback_data_free(RBGICallbackData *callback_data)
+ {
+ if (callback_data->callback) {
+ rb_gi_callback_free(callback_data->callback);
+ }
+- callback_data_unguard_from_gc(callback_data);
++ if (!NIL_P(callback_data->rb_owner)) {
++ GObject *gobject;
++ gobject = RVAL2GOBJ(callback_data->rb_owner);
++ g_object_weak_unref(gobject,
++ rb_gi_callback_data_weak_notify,
++ callback_data);
++ rbgobj_object_remove_relative(callback_data->rb_owner,
++ callback_data->rb_callback);
++ }
+ xfree(callback_data->metadata);
+ xfree(callback_data);
+ }
+@@ -349,7 +353,7 @@ rb_gi_callback_data_get_rb_callback(RBGI
+ }
+
+ static void
+-destroy_notify(gpointer data)
++rb_gi_callback_data_destroy_notify(gpointer data)
+ {
+ RBGICallbackData *callback_data = data;
+ rb_gi_callback_data_free(callback_data);
+@@ -1087,7 +1091,10 @@ ffi_closure_callback(G_GNUC_UNUSED ffi_c
+ }
+
+ static void
+-in_callback_argument_from_ruby(RBGIArgMetadata *metadata, GArray *in_args)
++in_callback_argument_from_ruby(RBGIArgMetadata *metadata,
++ GArray *in_args,
++ VALUE self,
++ VALUE rb_arguments)
+ {
+ gpointer callback_function;
+ GIArgInfo *arg_info;
+@@ -1145,12 +1152,25 @@ in_callback_argument_from_ruby(RBGIArgMe
+ callback_data->callback = callback;
+ callback_data->metadata = metadata;
+ callback_data->rb_callback = rb_block_proc();
+- callback_data_guard_from_gc(callback_data);
++ if (NIL_P(self)) {
++ callback_data->rb_owner = rb_ary_entry(rb_arguments, 0);
++ } else {
++ callback_data->rb_owner = self;
++ }
++ rbgobj_object_add_relative(callback_data->rb_owner,
++ callback_data->rb_callback);
++ {
++ GObject *gobject;
++ gobject = RVAL2GOBJ(callback_data->rb_owner);
++ g_object_weak_ref(gobject,
++ rb_gi_callback_data_weak_notify,
++ callback_data);
++ }
+ closure_argument->v_pointer = callback_data;
+ }
+
+ if (destroy_argument) {
+- destroy_argument->v_pointer = destroy_notify;
++ destroy_argument->v_pointer = rb_gi_callback_data_destroy_notify;
+ }
+ }
+
+@@ -1163,7 +1183,7 @@ in_argument_from_ruby(GICallableInfo *ca
+ VALUE self)
+ {
+ if (metadata->callback_p && !metadata->destroy_p) {
+- in_callback_argument_from_ruby(metadata, in_args);
++ in_callback_argument_from_ruby(metadata, in_args, self, rb_arguments);
+ return;
+ }
+
Home |
Main Index |
Thread Index |
Old Index