Hello.
I have a problem with Canvas.SaveHandleState and
Canvas.RestoreHandleState on GTK2. In my program I use TDrawGrid which uses the mentioned Save/Restore functions. I also do a drawing with many colors in another control, which causes frequent changes to the brush color while painting. After a few redraws I start getting such error messages:
TGtkWidgetSet.DeleteObject GdiObject=B1EC4440 gdiBrush is still used. DCCount=1 DC: B5D2D390 09967200=LCLWinapiClient [RMVDFStPrApDb] LCLObject=B5A76670=:TDrawGridEx<MainWidget=09966B58=LCLWinapiWidget><Is FixedWidget><Is CoreWidget>
And at the end of the program there's message:
[TGtkWidgetSet.Destroy] WARNING: There are 361 unreleased GDIObjects, a detailed dump follows:
[TGtkWidgetSet.Destroy] GDIOs: B6696E00 B6696CE0 B66967A0 B6696680 B6696140 B6696020 B66970A0
[TGtkWidgetSet.Destroy] gdiBrush: 361
I'm using Lazarus SVN trunk, FPC SVN trunk. I experience it with GTK 2.18 and GTK 2.20. I can reproduce the problem in small sample, but noticed something and wanted to ask first before posting bug report in Mantis.
The function writing the error is in lcl/interfaces/gtk/gtkwinapi.inc TGtkWidgetSet.DeleteObject: RaiseGDIObjectIsStillUsed. A comment inside there says:
"
// do not raise an exception, because this is a common bug in many programs
// just give a warning
"Does anyone know what common bug does this comment refer to? Is this a bug in my program? I have attached the sample that causes these errors. Maybe someone can tell me if I'm not supposed to draw this way?
I checked and the bug doesn't happen with LCLQT.
