Skip to content

Commit e10c6ac

Browse files
committed
Fix index destruction logic
1 parent d0ea371 commit e10c6ac

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

lib/hts/bam.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def index_loaded?
9797
end
9898

9999
def close
100-
LibHTS.hts_idx_destroy(@idx) if @idx&.null?
100+
LibHTS.hts_idx_destroy(@idx) if @idx && !@idx.null?
101101
@idx = nil
102102
super
103103
end

lib/hts/bcf.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def index_loaded?
9090
end
9191

9292
def close
93-
LibHTS.hts_idx_destroy(@idx) unless @idx&.null?
93+
LibHTS.hts_idx_destroy(@idx) if @idx && !@idx.null?
9494
@idx = nil
9595
super
9696
end

lib/hts/libhts/constants.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class HtsFormat < FFI::Struct
158158
:specific, :pointer
159159
end
160160

161-
class HtsIdx < FFI::Struct # FIXME: ManagedStruct
161+
class HtsIdx < FFI::Struct
162162
layout \
163163
:fmt, :int,
164164
:min_shift, :int,
@@ -189,9 +189,9 @@ class HtsIdx < FFI::Struct # FIXME: ManagedStruct
189189
:n_unmapped, :uint64
190190
)
191191

192-
def self.release(ptr)
193-
LibHTS.hts_idx_destroy(ptr) unless ptr.null?
194-
end
192+
# def self.release(ptr)
193+
# LibHTS.hts_idx_destroy(ptr) unless ptr.null?
194+
# end
195195
end
196196

197197
class HtsReglist < FFI::Struct

0 commit comments

Comments
 (0)