glib2 4.0.0 → 4.0.3

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: 3ffe632b39b4bf1a97a57a079224989e6a2e7c83f09b4a6a3d27806fd95f541f
4
- data.tar.gz: 0dd688a0ce0b2dbb4df08c4a4c282245683a8f2cbea27d55b7f2833ae029c550
3
+ metadata.gz: ffb0680897893bf81e94d3a5cfb8c271bf8ff785712a36c29b9a5f9afd0f0d6f
4
+ data.tar.gz: bf76c18a85f67ce4f1ccbab25841c09f99bddd1b191b39744b90e306685ba946
5
5
  SHA512:
6
- metadata.gz: edb56979dce1a887f979d32b1a86830ea1a57aee20b9cc68fb1e31b5b8f437ba8f4734601c1a810cea3d3fa09e4e90ad0bc997a3b035bade74ee22c6343675fd
7
- data.tar.gz: 46d9ddd70c9edd57e4af6bdaf336817b47eb5a2f3371e53af5f2f08f8853fb24790bf547920aa1a1df11cbb30cefaa10d36f727302b4b1c9bed1702d34b7c550
6
+ metadata.gz: e8c5c081d51ac5365b4797ceac91fedd1847c1f24f074f3b6afbd73a7c1f6b85ce110b7ea92b01b4f5dd211644e541da965d241a837aa0862aef578c9988eaa2
7
+ data.tar.gz: 77d472fd1de8f0339829b61b6a8b527ab5db3c022034fb1eda839e011dbe50db749c8dfe9f36d326baf3cd9c7d7849bfbe41c4c191fb7f2eed7773bd6dc2bd3f
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
@@ -330,7 +330,7 @@ static VALUE
330
330
  rg_to_s(int argc, VALUE *argv, VALUE self)
331
331
  {
332
332
  VALUE options = Qnil;
333
- gboolean type_annotate = false;
333
+ gboolean type_annotate = FALSE;
334
334
  rb_scan_args(argc, argv, ":", &options);
335
335
  if (!NIL_P(options)) {
336
336
  ID keywords[1];
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 0
36
+ #define RBGLIB_MICRO_VERSION 3
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);
@@ -69,6 +69,7 @@ static void
69
69
  Init_gtype_pointer(void)
70
70
  {
71
71
  VALUE cPtr = G_DEF_CLASS(G_TYPE_POINTER, "Pointer", rbg_mGLib());
72
+ rb_undef_alloc_func(cPtr);
72
73
  rbg_define_singleton_method(cPtr, "gtype", ptr_s_gtype, 1);
73
74
  rbg_define_method(cPtr, "gtype", ptr_gtype, 1);
74
75
  }
@@ -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.0
4
+ version: 4.0.3
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-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pkg-config