glib2 4.0.1 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc1ca98ff2e2ca2540e4f14ca4e41233478bf4df2294003f32b53e628b40d2bb
4
- data.tar.gz: 8d2318093b15b1489afd59c97df5a4e76df56a2b48eac599740b437882b74beb
3
+ metadata.gz: e7d1eb0a21b97c5152d4f792de24a5fc4c12074f1f38e1c0eb220d63e68c1adf
4
+ data.tar.gz: 792084386504df0ca97a1a8dcd0f5c5fae4cc0909ae93daf0699225d1a9bb52a
5
5
  SHA512:
6
- metadata.gz: e5d71af62d76175a21f453b465917be4b495c286283278ffc533d7afa91f148fa872c27defdba8f2b2beee75b53c0bfb234e1b4c229c7b9d18eee83cfb0ea3f2
7
- data.tar.gz: 7ee7bc7643e2d286d1eeff8c467236672f8939c12ffed17a58d891bb7f8f0eecc26e06935028414699a05024a4980691fea5b7b5ea5889299baf36d2867d9a23
6
+ metadata.gz: 68b6c0da8fac487e6267dfcf77b5695b838a8244702c241032f6a21a180cb7b9e403c642353efbec236d0fd5a2a9ffd6b6d241d85123fcc50038432b95599456
7
+ data.tar.gz: 7f369ff1a891dc192546b6c690ac819ad36610f13c3a69d68897607c41af214fb84d77312229c9c74c7777e9419c0ec06297d1c63939874c7d3e1deef015cf2c
data/ext/glib2/glib2.def CHANGED
@@ -77,6 +77,8 @@ EXPORTS
77
77
  g_rclosure_new_call
78
78
  g_rclosure_attach
79
79
  g_rclosure_attach_gobject
80
+ g_rclosure_detach
81
+ g_rclosure_detach_gobject
80
82
  g_rclosure_set_tag
81
83
  rbgobj_ruby_value_get_type
82
84
  g_value_get_ruby_value
data/ext/glib2/rbglib.h CHANGED
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
33
33
 
34
34
  #define RBGLIB_MAJOR_VERSION 4
35
35
  #define RBGLIB_MINOR_VERSION 0
36
- #define RBGLIB_MICRO_VERSION 1
36
+ #define RBGLIB_MICRO_VERSION 2
37
37
 
38
38
  #ifndef RB_ZALLOC
39
39
  # ifdef ZALLOC
@@ -234,6 +234,8 @@ g_rclosure_new_raw(VALUE callback_proc,
234
234
  rclosure);
235
235
  rclosure->tag[0] = '\0';
236
236
 
237
+ g_closure_ref(closure);
238
+ g_closure_sink(closure);
237
239
  g_closure_set_marshal(closure, &rclosure_marshal);
238
240
  g_closure_add_finalize_notifier(closure, NULL, rclosure_finalize);
239
241
 
@@ -271,7 +273,10 @@ void
271
273
  g_rclosure_attach(GClosure *closure, VALUE object)
272
274
  {
273
275
  GRClosure *rclosure = (GRClosure *)closure;
274
- rbgobj_add_relative(object, rclosure->rb_holder);
276
+ rbgobj_add_relative_removable(object,
277
+ Qnil,
278
+ id_closures,
279
+ rclosure->rb_holder);
275
280
  }
276
281
 
277
282
  void
@@ -286,6 +291,24 @@ g_rclosure_attach_gobject(GClosure *closure, VALUE object)
286
291
  rclosure->objects = g_list_prepend(rclosure->objects, gobject);
287
292
  }
288
293
 
294
+ void
295
+ g_rclosure_detach(GClosure *closure, VALUE object)
296
+ {
297
+ GRClosure *rclosure = (GRClosure *)closure;
298
+ rbgobj_remove_relative(object, id_closures, rclosure->rb_holder);
299
+ }
300
+
301
+ void
302
+ g_rclosure_detach_gobject(GClosure *closure, VALUE object)
303
+ {
304
+ GRClosure *rclosure = (GRClosure *)closure;
305
+ g_rclosure_detach(closure, object);
306
+
307
+ GObject *gobject = RVAL2GOBJ(object);
308
+ g_object_weak_unref(gobject, rclosure_weak_notify, rclosure);
309
+ rclosure_weak_notify(rclosure, gobject);
310
+ }
311
+
289
312
  void
290
313
  g_rclosure_set_tag(GClosure *closure, const gchar *tag)
291
314
  {
@@ -321,8 +344,6 @@ rg_initialize(VALUE self)
321
344
  {
322
345
  GClosure *closure = g_rclosure_new(rb_block_proc(), Qnil, NULL);
323
346
  G_INITIALIZE(self, closure);
324
- g_closure_ref(closure);
325
- g_closure_sink(closure);
326
347
  return self;
327
348
  }
328
349
 
@@ -23,6 +23,7 @@
23
23
 
24
24
  #define RG_TARGET_NAMESPACE cSignal
25
25
 
26
+ static ID id_connected_closures;
26
27
  static VALUE RG_TARGET_NAMESPACE;
27
28
  VALUE rbgobj_signal_wrap(guint sig_id);
28
29
 
@@ -415,9 +416,19 @@ gobj_sig_connect_impl(gboolean after, int argc, VALUE *argv, VALUE self)
415
416
  g_free(tag);
416
417
  handler_id = g_signal_connect_closure_by_id(g_object, signal_id, detail,
417
418
  rclosure, after);
418
- g_closure_unref(rclosure);
419
+ VALUE rb_handler_id = ULONG2NUM(handler_id);
420
+ if (handler_id != 0) {
421
+ VALUE rb_connected_closures = rb_ivar_get(self, id_connected_closures);
422
+ if (NIL_P(rb_connected_closures)) {
423
+ rb_connected_closures = rb_hash_new();
424
+ rb_ivar_set(self, id_connected_closures, rb_connected_closures);
425
+ }
426
+ rb_hash_aset(rb_connected_closures,
427
+ rb_handler_id,
428
+ POINTER2NUM(rclosure));
429
+ }
419
430
 
420
- return ULONG2NUM(handler_id);
431
+ return rb_handler_id;
421
432
  }
422
433
 
423
434
  static VALUE
@@ -604,6 +615,19 @@ static VALUE
604
615
  gobj_sig_handler_disconnect(VALUE self, VALUE id)
605
616
  {
606
617
  g_signal_handler_disconnect(RVAL2GOBJ(self), NUM2ULONG(id));
618
+ VALUE rb_connected_closures = rb_ivar_get(self, id_connected_closures);
619
+ if (NIL_P(rb_connected_closures)) {
620
+ return self;
621
+ }
622
+ VALUE rb_rclosure_pointer = rb_hash_aref(rb_connected_closures, id);
623
+ if (NIL_P(rb_rclosure_pointer)) {
624
+ return self;
625
+ }
626
+ GClosure *rclosure = NUM2POINTER(rb_rclosure_pointer);
627
+ if (!rclosure) {
628
+ return self;
629
+ }
630
+ g_rclosure_detach_gobject(rclosure, self);
607
631
  return self;
608
632
  }
609
633
 
@@ -971,6 +995,8 @@ rbgobj_define_action_methods(VALUE klass)
971
995
  void
972
996
  Init_gobject_gsignal(void)
973
997
  {
998
+ id_connected_closures = rb_intern("connected_closures");
999
+
974
1000
  VALUE cSignalFlags, cSignalMatchType;
975
1001
 
976
1002
  RG_TARGET_NAMESPACE = rb_define_class_under(rbg_mGLib(), "Signal", rb_cObject);
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2003-2021 Ruby-GNOME Project Team
3
+ * Copyright (C) 2003-2022 Ruby-GNOME Project Team
4
4
  * Copyright (C) 2002,2003 Masahiro Sakai
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -238,6 +238,8 @@ extern GClosure* g_rclosure_new_call(VALUE callback_proc,
238
238
  RGClosureCallFunc func);
239
239
  extern void g_rclosure_attach(GClosure *closure, VALUE object);
240
240
  extern void g_rclosure_attach_gobject(GClosure *closure, VALUE object);
241
+ extern void g_rclosure_detach(GClosure *closure, VALUE object);
242
+ extern void g_rclosure_detach_gobject(GClosure *closure, VALUE object);
241
243
  extern void g_rclosure_set_tag(GClosure *closure, const gchar *tag);
242
244
 
243
245
  /* rbgobj_value.c */
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib2
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-01 00:00:00.000000000 Z
11
+ date: 2022-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pkg-config