Skip to content

Properly escaping scoped GDAL objects #171

@joa-quim

Description

@joa-quim

Hi,
This is more a question on opinion if the GDAL crash that one obtains with the bellow example is due to bad usage or it reflects a true problem in GDAL.

If I take the last example in Quick Start and change it to write a in MEM dataset to look like this (I think I'm allowed to do it but not 100% sure)

AG.create(
    "",
    driver = AG.getdriver("MEM"),
    width=240,
    height=180,
    nbands=1,
    dtype=Float64
) do dataset
    AG.write!(dataset, Z, 1)
    AG.setgeotransform!(dataset, gt)
    AG.setproj!(dataset, crs)

   @show(dataset)
   #AG.getband(dataset, 1)
end

it prints

julia> include("test_gdal.jl")
dataset = GDAL Dataset (Driver: MEM/In Memory Raster)
File(s):

Dataset (width x height): 240 x 180 (pixels)
Number of raster bands: 1
  [GA_Update] Band 1 (Undefined): 240 x 180 (Float64)

NULL Dataset

So apparently it worked. But if I uncomment the #AG.getband(dataset, 1) line then GDAL crashes

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ffcf0076bfc -- GDALGetRasterColorInterpretation at C:\programs\compa_libs\DLLs_VC14_64\gdal_w64.DLL (unknown line)

Now, it happens that I've already seen this crashing message when trying to feed in GDAL an MEM driver written in C (from within GMT). At the time I discussed it a bit with Even Rouault in the GDAL mailing list but could not come out with a simple example that he could reproduce.

Whose fault do you think this is?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions