Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that dataset is still open when reading tags #628

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

JackDunnNZ
Copy link
Contributor

Previously this statement was outside the ctx context, and so dataset may already have been freed before we call dataset.tags(). In my experience, this was sporadically leading to either of the following errors:

rasterio.errors.RasterioIOError: Dataset is closed`

or

rasterio._err.ObjectNullError: Pointer 'hObject' is NULL in 'GDALGetMetadata'.

The corresponding statement for the read method was already inside the ctx context, so this was only a problem for the point method.

Previously this statement was outside the `ctx` context, and so `dataset` may already have been freed before we call `dataset.tags()`. In my experience, this was sporadically leading to either of the following errors:

```
rasterio.errors.RasterioIOError: Dataset is closed`
```

or 

```
rasterio._err.ObjectNullError: Pointer 'hObject' is NULL in 'GDALGetMetadata'.
```
@vincentsarago
Copy link
Member

good catch 🙏

@vincentsarago
Copy link
Member

@JackDunnNZ I'm going to merge this and make a new release today 🙏

@vincentsarago vincentsarago self-requested a review July 18, 2023 20:01
@vincentsarago vincentsarago merged commit 0d862e7 into cogeotiff:main Jul 18, 2023
@JackDunnNZ JackDunnNZ deleted the patch-1 branch July 18, 2023 20:20
@JackDunnNZ
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants