glib2 4.1.0 → 4.1.1

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: 3bb64b21272b534a3cc117234dad504e4df850da3b09dc1a2d58fea3f593495e
4
- data.tar.gz: 0707306a5390ab129b0559078dd63a1a498da626b52e9fc33407fbb6ba88a040
3
+ metadata.gz: 399d490f71821b01cb23b8bf9055dd4d432d66eb52a85a6e87339ba4ca30d85e
4
+ data.tar.gz: 572a338214811971c2d0311c76f46735135094b07205e4b5f593dc04ec2ac32c
5
5
  SHA512:
6
- metadata.gz: a5a99fa3761a880e4d6aac3997d3e628aac9de383191c2a7411292d5144692bda5910590a4b8b7ee8f5f206068ce6809813e6a99dce0a8a63d72551b3e46cda2
7
- data.tar.gz: 5a329090af62949beacb5ea6a849e0089d3c1f0d2b042b6f397df58ca6d6b159aefc40d34f84ba42a28b4dfcee41aaf9f2504c100de34ea54b12a46a8f2f0b70
6
+ metadata.gz: 43864daaf3a242bbd54ad1d322b5bae0288aa462fd425f6583935efc13378cf6d97e8ed7af03a8b52c2ef9907065e43ec1cfa28adbd0040fd0f16d132e390a75
7
+ data.tar.gz: f97c06d6b9ebdcca39919602afcf62fc9df7223fa60370b535d98641d6dca909f08ea91d2e0447df95e4064103d267e2fc728d8f9eb73188a1c0c181c2363de4
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 1
36
- #define RBGLIB_MICRO_VERSION 0
36
+ #define RBGLIB_MICRO_VERSION 1
37
37
 
38
38
  #ifndef RB_ZALLOC
39
39
  # ifdef ZALLOC
@@ -180,15 +180,26 @@ rbgobj_boxed_initialize(VALUE obj, gpointer boxed)
180
180
  gpointer
181
181
  rbgobj_boxed_get_default(VALUE obj, GType gtype)
182
182
  {
183
- boxed_holder *holder;
184
-
185
- if (!RVAL2CBOOL(rb_obj_is_kind_of(obj, GTYPE2CLASS(gtype))))
183
+ VALUE klass = GTYPE2CLASS(gtype);
184
+
185
+ if (!RVAL2CBOOL(rb_obj_is_kind_of(obj, klass))) {
186
+ ID id_try_convert;
187
+ CONST_ID(id_try_convert, "try_convert");
188
+ if (rb_respond_to(klass, id_try_convert)) {
189
+ VALUE converted_obj = rb_funcall(klass, id_try_convert, 1, obj);
190
+ if (!NIL_P(converted_obj)) {
191
+ obj = converted_obj;
192
+ }
193
+ }
194
+ }
195
+ if (!RVAL2CBOOL(rb_obj_is_kind_of(obj, klass))) {
186
196
  rb_raise(rb_eArgError,
187
197
  "invalid argument %" PRIsVALUE " (expect %" PRIsVALUE ")",
188
198
  CLASS_OF(obj),
189
199
  GTYPE2CLASS(gtype));
200
+ }
190
201
 
191
- holder = rbgobj_boxed_get_raw(obj);
202
+ boxed_holder *holder = rbgobj_boxed_get_raw(obj);
192
203
  if (!holder->boxed)
193
204
  rb_raise(rb_eArgError, "uninitialize %" PRIsVALUE,
194
205
  CLASS_OF(obj));
@@ -1044,6 +1044,11 @@ rbgobj_register_type(VALUE klass, VALUE type_name, GClassInitFunc class_init)
1044
1044
  StringValueCStr(type_name),
1045
1045
  info,
1046
1046
  0);
1047
+ if (type == G_TYPE_INVALID) {
1048
+ rb_raise(rb_eArgError,
1049
+ "failed to register type: <%s>",
1050
+ StringValueCStr(type_name));
1051
+ }
1047
1052
 
1048
1053
  rbgobj_register_class(klass, type, TRUE, TRUE);
1049
1054
 
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.1.0
4
+ version: 4.1.1
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: 2023-01-31 00:00:00.000000000 Z
11
+ date: 2023-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pkg-config