Recent

Author Topic: BGRAbitmap.canvas.TextExtend crashes  (Read 1355 times)

winni

  • Hero Member
  • *****
  • Posts: 2500
BGRAbitmap.canvas.TextExtend crashes
« 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


Winni


« Last Edit: May 07, 2021, 09:19:58 pm by winni »

circular

  • Hero Member
  • *****
  • Posts: 3717
    • Personal webpage
Re: BGRAbitmap.canvas.TextExtend crashes
« Reply #1 on: May 08, 2021, 05:26:46 am »
That's strange indeed.

Any details on the stack trace?
« Last Edit: May 08, 2021, 05:29:59 am by circular »
Conscience is the debugger of the mind

Roland57

  • Full Member
  • ***
  • Posts: 187
Re: BGRAbitmap.canvas.TextExtend crashes
« Reply #2 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]$


Roland57

  • Full Member
  • ***
  • Posts: 187
Re: BGRAbitmap.canvas.TextExtend crashes
« Reply #3 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.
« Last Edit: May 08, 2021, 07:11:45 am by Roland57 »

circular

  • Hero Member
  • *****
  • Posts: 3717
    • Personal webpage
Re: BGRAbitmap.canvas.TextExtend crashes
« Reply #4 on: May 08, 2021, 04:50:50 pm »
Hmm so it might be related to the 0 height size.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018