Gentlefolk,
Environment: Win XP, SP3, Laz 0.29, 28602.
I have a small class as follows:
unit UnitMultiReg;
type
TRegMulti = class(TObject)
RegArray : array of Integer; // [0..cMaxRegs-1] of Integer;
RegSize : Integer; // Local size of the array
Function SetRegArraySize(InSize : Integer) : Integer;
Function ClearReg(InReg : Integer) : Integer;
end;
var
UR : TRegMulti;
In another module I create the instance UR with
UnitMultiReg.UR := TRegMulti.Create;
All compile clean.
At run time the Function SetRegArraySize(InSize : Integer) : Integer; is called,
the array and RegSize are set to the value of InSize.
In debug all looks OK.
Later in the program the program fails in Function ClearReg.
In Debug the rray shows as RegArray = array(nil) and RegSize = 0.
Nowhere do I destroy or free UR.
Somehow I am losing UR and/or it's contents or missing something conceptual.
Any suggestions, ideas, whatever?
Thanks, Ian