AV when calling setlength on a dynamic array of boolean



Hey,

In an object I use a dynamic array of booleans to store some hardware
signals.

FSignalArray: array of Boolean;

When I initialise the object it reads from a database and calculates
those booleans. The first line of the initialising is

SetLength(FSignalArray, DBSize);

and it works fine. However, when I stop running I can't do

SetLength(FSignalArray, 0);
or
FSignalArray:=nil;

If I do so, the program crashes with an invalid pointer operation or an
access violation.
If I remove that line it works fine, except that when I re-initialise
the object,

SetLength(FSignalArray, DBSize);

crashes with an access violation even though DBSize is unchanged. Still
using Delphi 6, what am I missing here?

.



Relevant Pages