Skip to content

Commit

Permalink
guard references
Browse files Browse the repository at this point in the history
  • Loading branch information
jcupitt committed Feb 19, 2024
1 parent e29e2b6 commit 257bcdb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/vips/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -458,14 +458,14 @@ def self.new_from_source source, option_string, **opts
loader = Vips.vips_foreign_find_load_source source
raise Vips::Error if loader.nil?

image = Vips::Operation.call loader, [source], opts, option_string
result = Vips::Operation.call loader, [source], opts, option_string

# keep a secret ref to the source object ... the libvips loader will
# keep a ref to the C source object, but we need the ruby wrapper object
# to stay alive too
image.references << source
result.references << source if result.is_a?(Vips::Image)

image
result
end

def self.matrix_from_array width, height, array
Expand Down

0 comments on commit 257bcdb

Please sign in to comment.