Closed Huite closed 1 year ago
@PeterPetrik Hi Peter, do you know if this could be related to MDAL specifically or its integration in qgis?
Seems to be the case only on Windows.
This could be problem in either QGIS (not calling MDAL_CloseMesh appropriately) or MDAL (some issue with MDAL_CloseMesh for netCDF driver). Thanks for very good bug description, I will try to look before next release
MDAL issue fixed by https://github.com/lutraconsulting/MDAL/pull/426
I will close this issue when new MDAL release will be imported in QGIS master.
Works fine in latest master (3642c9cc40).
What is the bug or the crash?
I've been interacting with some UGRID netCDFs via QGIS. When removing a layer from QGIS (via layers panel or PyQGIS), this does not seem to release the file lock: when I e.g. try to delete the file, I get a message "access denied on file".
I've done a little bit of testing with some of the test files in the MDAL repository. I haven't tested exhaustively, but it seems to turn up only on the formats utilizing netCDF specifically. So I cannot delete UGRID files, Tuflow files even after removing the layers. The GRIB file (
wind_only_u_component.grib
) gives no problems.Interestingly, adding a different file which requires the same driver seems to free the file again.
Steps to reproduce the issue
https://github.com/lutraconsulting/MDAL/blob/master/tests/data/ugrid/D-Flow1.2/bw_11_zonder_riviergrid_met_1dwtg_clm.nc
and:
https://github.com/lutraconsulting/MDAL/blob/master/tests/data/tuflowfv/withMaxes/trap_steady_05_3D.nc
Add the file as a Mesh Layer in QGIS.
Remove the file via the Layers Panel > Remove Layers.
Open file manager, and try to delete the downloaded file.
Add another file which requires the same driver (copy one of the above files if needed).
Go back to file manager, and try to delete the file once more.
Versions
I get the same behavior on 3.16, 3.18 and 3.20.
Additional context
No response