why using reintroduce with virtual = access violation on ios 32 bit?

  

I have what I think is a Delphi bug but would have a confirmation of it. Everything works well on Android or iOS 64, but when I compile my program under iOS 32 bits it’s crash with Access violation error.

I made this class:

type
TALTexture = class(TTexture)
private
fVolatile: Boolean;
public
constructor Create(const aVolatile: Boolean = True); reintroduce; virtual;
end;

constructor TALTexture.Create(const aVolatile: Boolean = True);
begin
inherited Create;
fVolatile := aVolatile;
if fVolatile then Style := Style + [TTextureStyle.Volatile];
end;

Notice here that I use reintroduce; virtual;. This makes my program crash at a very unexpected time, for example when I do

var LastTotalMemoryUsedByTexturesLog: int64;

procedure TALTexture.Assign(Source: TPersistent);
begin

AtomicCmpExchange(LastTotalMemoryUsedByTexturesLog, 0, 0)); // << make EAccessViolation

end;

this makes the program crash with EAccessViolation when doing the line AtomicCmpExchange(LastTotalMemoryUsedByTexturesLog, 0, 0));

If I remove the word virtual from the contructor :

type
TALTexture = class(TTexture)
public
constructor Create(const aVolatile: Boolean = True); reintroduce;
end;

then everything work fine! So did i do something wrong when i do reintroduce; virtual; ? What workaround can i Use?

Comments are closed.