SAFEARRAY* are not freed
Charlie Heap is using Delphi and he reported:
I think I may also have found a small issue in which the Options get locked by calls to GDALUtils and don’t get properly unlocked – even if you destroy the GDAL Utils component. This causes an error message in Delphi apps as follows: “Variant or Safe Array is locked”.
The suggested changes have been made in commit
Waiting for Charlie to confirm it is also solving his problem in Delphi.
Searching for all occurrences of SafeArrayAccessData, it looks like the following are missing the corresponding SafeArrayUnaccessData:
investigated this and concluded:
The short of it is that each call to SafeArrayAccessData should have a corresponding call to SafeArrayUnaccessData, once we are done iterating/evaluating the contents of the array. There are a number of places in the code in which you'll find the array is left locked, but I would guess that for many of these, the array is only internal, and the circumstances aren't revealing that a lock is left in place.