#3 GLSound - TGLSoundSample.Assign calling wrong inherited!

Unstable_(example)
closed-fixed
nobody
5
2011-04-24
2011-04-24
Anonymous
No

I found this when I used form inheritance - that uses assign() for child items - I get access violation and crash the IDE

GLSound, Line 590 - Current code

procedure TGLSoundSample.Assign(Source: TPersistent);
begin
if Source is TGLSoundSample then begin
FName:=TGLSoundSample(Source).Name;
FData.Free;
FData:=TGLSoundFile(TGLSoundSample(Source).Data.CreateCopy(Self));
end;
inherited Destroy;
end;

Corrected code:

procedure TGLSoundSample.Assign(Source: TPersistent);
begin
if Source is TGLSoundSample then begin
FName:=TGLSoundSample(Source).Name;
FData.Free;
FData:=TGLSoundFile(TGLSoundSample(Source).Data.CreateCopy(Self));
end
else inherited Assign(Source);
end;

Discussion

  • YarUnderoaker

    YarUnderoaker - 2011-04-24
    • status: open --> closed
     
  • YarUnderoaker

    YarUnderoaker - 2011-04-24

    Fixed. Thanks.

     
  • YarUnderoaker

    YarUnderoaker - 2011-04-24
    • status: closed --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks