Lazarus

Programming => Graphics => Graphics and Multimedia => BGRABitmap and LazPaint => Topic started by: winni on May 07, 2021, 09:17:55 pm

Title: BGRAbitmap.canvas.TextExtend crashes
Post by: winni on May 07, 2021, 09:17:55 pm
Hi!

I report an error found by a BGRA newbie in the german forum:

He testeted a lot of functions and found out that
Code: Pascal  [Select][+][-]
  1.  
  2. BGRAbitmap.canvas.TextExtend  

crashes. The astonishing circumstances: You can use it one time. But if you use it the second time you get a SIGSEV

I think this is not detected because nobody uses the BGRAbitmap.canvas - there is no need.


German forum discussion: https://www.lazarusforum.de/viewtopic.php?f=19&t=13601&p=121678#p121678 (https://www.lazarusforum.de/viewtopic.php?f=19&t=13601&p=121678#p121678)


Winni


Title: Re: BGRAbitmap.canvas.TextExtend crashes
Post by: circular on May 08, 2021, 05:26:46 am
That's strange indeed.

Any details on the stack trace?
Title: Re: BGRAbitmap.canvas.TextExtend crashes
Post by: Roland57 on May 08, 2021, 07:05:54 am
Here is what I get here, starting the program from a terminal:

[roland@localhost textextent]$ ./project1
// After clicking on the button:
(project1:30355): GLib-GObject-CRITICAL **: 06:53:29.357: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
// x 19
// After closing the application:
[TGtk2WidgetSet.Destroy] WARNING: There are 1 unreleased DCs, a detailed dump follows:
[TGtk2WidgetSet.Destroy]  DCs:   00007FE0CE51C440
[TGtk2WidgetSet.Destroy] WARNING: There are 2 unreleased GDIObjects, a detailed dump follows:
[TGtk2WidgetSet.Destroy]   GDIOs: 00007FE0CE97C440 00007FE0CE97C1C0
[TGtk2WidgetSet.Destroy]   gdiBitmap: 2
(project1:30355): GLib-GObject-CRITICAL **: 06:53:37.285: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
[roland@localhost textextent]$

Title: Re: BGRAbitmap.canvas.TextExtend crashes
Post by: Roland57 on May 08, 2021, 07:09:47 am
But if I add this,

Code: Pascal  [Select][+][-]
  1. begin
  2.   BM := TBGRABitmap.Create(100, 32, BGRABlack);
  3.   BM.FontHeight := 16;
  4.   BM.Canvas.Font.Height := 16; // <---  

the problem is solved.
Title: Re: BGRAbitmap.canvas.TextExtend crashes
Post by: circular on May 08, 2021, 04:50:50 pm
Hmm so it might be related to the 0 height size.
TinyPortal © 2005-2018