Page 1 of 1

Error in gflLoadBitmapFromMemory ?

Posted: Sat Jul 04, 2009 8:55 pm
by madiazg
Hello!!!
I have problems with the new version of the library.
My program works correctly with version 2.90 but with the current version seems to have a problem with gflLoadBitmapFromMemory.
Apparently, gflLoadBitmapFromMemory modify the content of other variables in the program. This is quite strange.
I will investigate further to see if an error in the function.
Regards...
Miguel Angel
http://imagen3d.site88.net

Re: Error in gflLoadBitmapFromMemory ?

Posted: Sat Jul 04, 2009 11:40 pm
by madiazg
I have solved the problem by declaring the variable in other place of the program.
The variables involved are of type Boolean

Regards...
Miguel Angel
http://imagen3d.site88.net

Re: Error in gflLoadBitmapFromMemory ?

Posted: Sun Jul 05, 2009 6:25 am
by dominique
Hello,
You should post some code with wrong memory access so I can do similar tests :D
See ya,

Re: Error in gflLoadBitmapFromMemory ?

Posted: Sun Jul 05, 2009 8:10 am
by madiazg
Hello!!!...
To save an image in memory I use the code:

Code: Select all

unit Principal;
....
var
  Imagen1LbStream : TMemoryStream;
  Imagen1LbExiste : Boolean;
...
implementation
....

procedure TFormPrincipal.Action37Execute(Sender: TObject); 
var
  Size : integer;
  Mem : PGFL_UINT8;
  spMem : TGFL_SAVE_PARAMS;
...
begin
....
  gflGetDefaultSaveParams(spMem);
  spMem.FormatIndex := gflGetFormatIndexByName('bmp');
  gflSaveBitmapIntoMemory(Mem,@Size,gfl_bmp1Lb,spMem);
  Imagen1LbStream.Clear;
  Imagen1LbStream.Write(Mem^,Size);
  gflMemoryFree(Pointer(Mem));
  gflFreeBitmapData(gfl_bmp1Lb);  //Se libera porque ya se ha usado en cargar las imágenes
  Imagen1LbExiste := True;
end;

In another part of the program:

Code: Select all

  gflFreeBitmapData(gfl_bmp1Lb);
  gflLoadBitmapFromMemory(Imagen1LbStream.Memory, Imagen1LbStream.Size,gfl_bmp1Lb, lp1Lb, finfo1Lb); 
After running the function, the variable (Imagen1LbExiste) becomes false.
I have solved the problem by declaring the variable in a different unit.

I work with TurboDelphi:

Regards...
Miguel Angel
http://imagen3d.site88.net

Re: Error in gflLoadBitmapFromMemory ?

Posted: Mon Jul 06, 2009 7:25 am
by xnview
gflMemoryFree overwrite your boolean??

Re: Error in gflLoadBitmapFromMemory ?

Posted: Mon Jul 06, 2009 9:44 am
by madiazg
No, apparently I have the problem with gflLoadBitmapFromMemory.

Miguel Angel

Re: Error in gflLoadBitmapFromMemory ?

Posted: Tue Jul 07, 2009 8:19 am
by dominique
I test this functions without this kind of error.
There might be something wrong elsewhere in your code ?
Do you test the same code in a small project with only this features ?

Re: Error in gflLoadBitmapFromMemory ?

Posted: Wed Jul 08, 2009 5:54 pm
by madiazg
Hello,
I will continue doing tests to try to determine under what conditions these errors occur.
The program is quite dense and heavy and uses a large amount of memory and variables. I will make a program easier for to try to reproduce the error.

Miguel Angel

Re: Error in gflLoadBitmapFromMemory ?

Posted: Fri Jul 31, 2009 5:49 pm
by madiazg
Hi,
this time I'm having problems with gflLoadBitmap.

'Access violation at address 00984784 in module libgfl311.dll' Read of address 00000030.

The error occurs as above, substituting libgfl2.90 by libgfl3.11 without modifying the source code of the program.

I fixed the problem, as the previous case, stating gflbitmap in another unit of the program.

The problem I have is that I can not reproduce the error in a simple program so I can not analyze the causes of the error.

Miguel Angel

Re: Error in gflLoadBitmapFromMemory ?

Posted: Mon Aug 03, 2009 9:08 pm
by dominique
Hello,
Have you tried to remove/comment "unsafe" code : for exemple newest code, special memory allocation/delete... This kind of error is difficult to fix.
Help yourself with your debugger.
I don't think Pierre could help you without more information.