TZConnection.Free causes List index out of bounds error
Posted: 11.02.2021, 11:20
When the TZAbstractConnection.UnregisterAllComponents cycle is going through all queries and sets the Connection property to nil, TZAbstractRODataset.SetConnection is calling FConnection.UnregisterComponent(Self) - therefore removing the item from the FLinkedComponents list UnregisterAllComponents is currently enumerating.
E.g. in the first cycle it has 2 elements, calling unregister on one makes the list to have only 1 element (with the index of 0). The second cycle is attempting to remove index 1 - raising the error.
Fix is available on GitHub.
E.g. in the first cycle it has 2 elements, calling unregister on one makes the list to have only 1 element (with the index of 0). The second cycle is attempting to remove index 1 - raising the error.
Fix is available on GitHub.