Skip to content

Commit af38d54

Browse files
committed
fix standardrb warnings
1 parent d3938ab commit af38d54

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
## Version 2.1.1 (2021-5-3)
66

77
* fix "mutate" with libvips 8.9 [jcupitt]
8+
* update autodocs for libvips 8.11 [jcupitt]
89

910
## Version 2.1.0 (2021-3-8)
1011

lib/vips/mutableimage.rb

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,16 @@ def set_type! gtype, name, value
119119

120120
# libvips 8.9.1 had a terrible misfeature which would block metadata
121121
# modification unless the object had a ref_count of 1. MutableImage
122-
# will always have a ref_count of at least 2 (the parent gobject keeps a
123-
# ref, and we keep a ref to the copy ready to return to our caller),
122+
# will always have a ref_count of at least 2 (the parent gobject keeps a
123+
# ref, and we keep a ref to the copy ready to return to our caller),
124124
# so we must temporarily drop the refs to 1 around metadata changes.
125125
#
126126
# See https://github.com/libvips/ruby-vips/issues/291
127127
begin
128-
::GObject.g_object_unref self.ptr
128+
::GObject.g_object_unref ptr
129129
Vips.vips_image_set self, name, gvalue
130130
ensure
131-
::GObject.g_object_ref self.ptr
131+
::GObject.g_object_ref ptr
132132
end
133133

134134
gvalue.unset
@@ -163,13 +163,11 @@ def set! name, value
163163
#
164164
# @param name [String] Metadata field to remove
165165
def remove! name
166-
# See set_type! for an explanation.
167-
begin
168-
::GObject.g_object_unref self.ptr
169-
Vips.vips_image_remove self, name
170-
ensure
171-
::GObject.g_object_ref self.ptr
172-
end
166+
# See set_type! for an explanation. Image#remove can't throw an
167+
# exception, so there's no need to ensure we unref.
168+
::GObject.g_object_unref ptr
169+
Vips.vips_image_remove self, name
170+
::GObject.g_object_ref ptr
173171
end
174172
end
175173
end

0 commit comments

Comments
 (0)