Recent

Author Topic: BGRABitmap create crash  (Read 3356 times)

Timewarp

  • Full Member
  • ***
  • Posts: 144
BGRABitmap create crash
« on: August 22, 2012, 09:39:06 am »
With some images I get crash by using this line:

b:=TBGRABitmap.create('test.tif');

But it works like this

b:=TBGRABitmap.create;
b.loadfromfile('test.tif');
Code: [Select]
constructor TBGRADefaultBitmap.Create(AFilename: string);
begin
  Init;
  LoadFromFile(Afilename);
end; 
Maybe it should be like this? (same for stream version)
Code: [Select]
constructor TBGRADefaultBitmap.Create(AFilename: string);
begin
  Init;
  inherited Create(0, 0);
  LoadFromFile(Afilename);
end;

circular

  • Hero Member
  • *****
  • Posts: 3508
    • Personal webpage
Re: BGRABitmap create crash
« Reply #1 on: August 22, 2012, 03:28:54 pm »
Does it fix the problem if you do the change you propose ?
Conscience is the debugger of the mind

Timewarp

  • Full Member
  • ***
  • Posts: 144
Re: BGRABitmap create crash
« Reply #2 on: August 22, 2012, 03:48:15 pm »
Does it fix the problem if you do the change you propose ?
Yes it does

bgradefaultbitmap.pas all other constructors have similar line. Is there some reason why it's not in these two?

constructor TBGRADefaultBitmap.Create(AFilename: string);
constructor TBGRADefaultBitmap.Create(AStream: TStream);

I can attach some image to test, if needed
« Last Edit: August 22, 2012, 03:55:17 pm by Timewarp »

circular

  • Hero Member
  • *****
  • Posts: 3508
    • Personal webpage
Re: BGRABitmap create crash
« Reply #3 on: August 22, 2012, 04:25:27 pm »
I suppose I tried to avoid initiliazing size twice. But if it can crash, then let's add the "inherited" line.

EDIT: Done. It's updated on subversion.
« Last Edit: August 22, 2012, 04:27:55 pm by circular »
Conscience is the debugger of the mind

VTwin

  • Hero Member
  • *****
  • Posts: 936
  • Former Turbo Pascal 3 user
Re: BGRABitmap create crash
« Reply #4 on: June 24, 2013, 04:50:43 pm »
Just sending a big thanks for finding and fixing this bug. It had me stymied for a while, couldn't figure out why I was getting crashes with tif files.

Cheers,
Frederick 
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.0
macOS 10.13.6: Lazarus 2.0.10 (64 bit Cocoa)
Ubuntu 18.04.3: Lazarus 2.0.10 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.10 (64 bit on VBox)

 

TinyPortal © 2005-2018