Recent

Author Topic: Strange Bug with TFileStream on Lazarus MacOS  (Read 6055 times)

wagenheimer

  • New Member
  • *
  • Posts: 21
Strange Bug with TFileStream on Lazarus MacOS
« on: April 24, 2011, 10:41:45 pm »
Code: [Select]
  Stream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyNone);
  try
    LoadFromStream(Stream);
  finally
    Stream.Free;
  end;

I'm getting Access Violations on Stream.Free on Lazarus 0.9.31 and FPC 2.4.2, on MacOS. The same code works on Delphi 2010.

If I remove Stream.Free it works, but the file remains open.

Has anyone gone through something similar?

Laksen

  • Hero Member
  • *****
  • Posts: 755
    • J-Software
Re: Strange Bug with TFileStream on Lazarus MacOS
« Reply #1 on: April 24, 2011, 11:04:51 pm »
What if you comment out the call to LoadFromStream?

wagenheimer

  • New Member
  • *
  • Posts: 21
Re: Strange Bug with TFileStream on Lazarus MacOS
« Reply #2 on: April 24, 2011, 11:58:00 pm »
Thanks Laksen!

The problem seens to happens in the LaodFromStream.

I found the problem happens here :

Code: [Select]
  Stream.Read(FFilterMin, SizeOf(FFilterMin));
  Stream.Read(FFilterMag, SizeOf(FFilterMag));

 TPHXTextureFilter = (
    // GL_NEAREST
    tfNearest,
    // GL_LINEAR
    tfLinear,
    // GL_NEAREST_MIPMAP_NEAREST
    tfNearestMipmapNearest,
    // GL_LINEAR_MIPMAP_NEAREST
    tfLinearMipmapNearest,
    // GL_NEAREST_MIPMAP_LINEAR
    tfNearestMipmapLinear,
    // GL_LINEAR_MIPMAP_LINEAR
    tfLinearMipmapLinear);

  TPHXTextureFilterMag = tfNearest .. tfLinear;

  TPHXTextureFilterMin = tfNearest .. tfLinearMipmapLinear;     

Have you any ideia of what is wrong?

wagenheimer

  • New Member
  • *
  • Posts: 21
Re: Strange Bug with TFileStream on Lazarus MacOS
« Reply #3 on: April 25, 2011, 01:30:31 am »
Thanks!

Code: [Select]
{$IFDEF FPC}
  {$packset 1}
{$ENDIF}

This fixed my problem!

 

TinyPortal © 2005-2018