Skip to content

Commit

Permalink
Merge pull request #80 from tlnagy/tn/fix-mmap-reopening-bug
Browse files Browse the repository at this point in the history
Fix crash when attempting to reopen a stream on mmap access
  • Loading branch information
tlnagy authored Apr 6, 2021
2 parents 9610f96 + 84f30cb commit 7895180
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OMETIFF"
uuid = "2d0ec36b-e807-5756-994b-45af29551fcf"
authors = ["Tamas Nagy <[email protected]>"]
version = "0.3.10"
version = "0.3.11"

[deps]
AxisArrays = "39de3d68-74b9-583c-8d2d-e117c070f3a9"
Expand Down
2 changes: 1 addition & 1 deletion src/mmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function Base.getindex(A::ReadonlyTiffDiskArray{Gray{T}, R, N1, N2}, i1::Int, i2
# if the file isn't open, lets open a handle and update it
if !isopen(ifd.file.io)
path = ifd.file.filepath
ifd.file.io = getstream(open(path), path)
ifd.file.io = getstream(open(path))
end

n_strips = length(ifd.strip_offsets)
Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ end
@test all(img[1:10,1,1,1] .== img2[1:10,1,1,1])
# file is read only and should throw an error if you try and modify it
@test_throws ErrorException img[1:10,1,1,1] .= 1.0

# test reopening the file stream on access if closed
close(s)
@test img[10, 10, 2, 1] == img2[10, 10, 2, 1]
end
end
end
Expand Down

2 comments on commit 7895180

@tlnagy
Copy link
Owner Author

@tlnagy tlnagy commented on 7895180 Apr 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/33617

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.11 -m "<description of version>" 78951803348f9a9c9c829f7a77a5e4dc1138eaa2
git push origin v0.3.11

Please sign in to comment.