Re: [gdal-dev] help please with close/reopen and GDALSubdatasetInfo

2023-12-03 Thread Michael Sumner via gdal-dev
Awesome, thank you! I was a bit lost - learnt a lot from exploring this though. Cheers, Mike On Mon, Dec 4, 2023 at 12:11 AM Even Rouault wrote: > Hi Michael, > > It was most missing a "break;" statement when the subdataset of interest > has been found to exit the loop. Without the break, th

Re: [gdal-dev] help please with close/reopen and GDALSubdatasetInfo

2023-12-03 Thread Even Rouault via gdal-dev
Hi Michael, It was most missing a "break;" statement when the subdataset of interest has been found to exit the loop. Without the break, the loop will continue to read papszSubdatasets[] which has been invalidated by the poSrcDS->ReleaseRef(). Ah, memory unsafe languages :-). You also had a f

[gdal-dev] help please with close/reopen and GDALSubdatasetInfo

2023-12-02 Thread Michael Sumner via gdal-dev
May I please ask for assistance with this code? I'm trying to close a dataset with subdatasets and then reopen if the requested subdataset is found. It segfaults for all but the last subdataset name ... and I'm at a loss for what I'm doing wrong. Thank you. Code below, and this gist documents i