Error in gflLoadBitmapFromMemory ?

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

Post Reply
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias
Contact:

Error in gflLoadBitmapFromMemory ?

Post 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
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias
Contact:

Re: Error in gflLoadBitmapFromMemory ?

Post 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
User avatar
dominique
Posts: 72
Joined: Thu Nov 08, 2007 9:22 am

Re: Error in gflLoadBitmapFromMemory ?

Post by dominique »

Hello,
You should post some code with wrong memory access so I can do similar tests :D
See ya,
Dom
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias
Contact:

Re: Error in gflLoadBitmapFromMemory ?

Post 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
User avatar
xnview
Author of XnView
Posts: 43442
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Error in gflLoadBitmapFromMemory ?

Post by xnview »

gflMemoryFree overwrite your boolean??
Pierre.
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias
Contact:

Re: Error in gflLoadBitmapFromMemory ?

Post by madiazg »

No, apparently I have the problem with gflLoadBitmapFromMemory.

Miguel Angel
User avatar
dominique
Posts: 72
Joined: Thu Nov 08, 2007 9:22 am

Re: Error in gflLoadBitmapFromMemory ?

Post 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 ?
Dom
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias
Contact:

Re: Error in gflLoadBitmapFromMemory ?

Post 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
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias
Contact:

Re: Error in gflLoadBitmapFromMemory ?

Post 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
User avatar
dominique
Posts: 72
Joined: Thu Nov 08, 2007 9:22 am

Re: Error in gflLoadBitmapFromMemory ?

Post 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.
Dom
Post Reply