I was able to reproduce an error in the Shapefile Draw method, related to an attempt to delete an unallocated array.
qtreeResult is declared to hold an array of integers, the result of a quad tree selection.
But the array may not be allocated, and if not, the code branches to the 'cleaning' label
Finally, in the 'cleaning' section, qtreeResult could be deleted even though it may not have been allocated.
I have made changes to the code as follows: