On 16/11/2013 01:03, Timothy Groves wrote:
Here's the code I *actually* have in the method:
var
index,
last : integer;
begin
last := length (t_volumes) - 1;
index := 0;
while ((t_volumes [index] <> t_current_volume) and (index < last)) do
inc (index);
if (index < last) then begin
t_volumes [index] := t_volumes [last];
Objects are actually stored via a reference (internal pointer)
So t_volumes [last] just points to the objects data
The above statement duplicates the reference
t_volumes [last].Destroy;
destroys the object pointed to by both: t_volumes [last] and t_volumes
[index]
You should have destroyed t_volumes [index] *before* copying the value
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal