[Gambas-bugtracker] Bug #2436: Menubutton getting "invalid object" on gtk

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Tue Jan 4 13:40:21 CET 2022


http://gambaswiki.org/bugtracker/edit?object=BUG.2436&from=L21haW4-

Comment #10 by Benoît MINISINI:

It should be fixed by commit https://gitlab.com/gambas/gambas/-/commit/06d751bb0b81b7f78a5bb4f347f41a2a830e7481.

The problem comes from the fact - sorry don't be upset - that your code is a bit of a mess, and precisely because your are modifying the icon controls during the icon drawing routine.

You set the font of the Icon during its 'Draw' event handler (!), and because of a bug in the GTK+ component, it triggered a refresh of itself even if the font was the same (the Qt components didn't have this problem).

Consequently, each icon refreshes again and again (hence the abyssal slowness). And apparently GTK+ does not like too many refreshes, as it lead to the crash you encountered.

In summary, do only drawing stuff inside drawing event handlers! At least don't modify the control, you may create an infinite loop of refreshes.

Benoît MINISINI changed the state of the bug to: Fixed.




More information about the Bugtracker mailing list