LCL-GTK2 & GTK3: Repaint MenuItem when changing ImageIndex. Issue #37607, patch from Anton Kavalenka.

git-svn-id: trunk@63823 -
This commit is contained in:
juha 2020-08-25 08:31:30 +00:00
parent 7bfebf3d58
commit b420c52946
2 changed files with 5 additions and 3 deletions

View File

@ -488,7 +488,9 @@ class procedure TGtk2WSMenuItem.UpdateMenuIcon(const AMenuItem: TMenuItem;
begin
if not WSCheckMenuItem(AMenuItem, 'UpdateMenuIcon') then
Exit;
if gtk_is_check_menu_item({%H-}Pointer(AMenuItem.Handle)) <> HasIcon then
// recreating menu handle without icon may lead to failures like
// main menu bar vanishing, see mantis issue #37607
if HasIcon then
AMenuItem.RecreateHandle;
end;

View File

@ -556,8 +556,8 @@ class procedure TGtk3WSMenuItem.UpdateMenuIcon(const AMenuItem: TMenuItem;
begin
if not WSCheckMenuItem(AMenuItem, 'UpdateMenuIcon') then
Exit;
// if gtk_is_check_menu_item({%H-}Pointer(AMenuItem.Handle)) <> HasIcon then
AMenuItem.RecreateHandle;
if HasIcon then
AMenuItem.RecreateHandle;
end;
{ TGtk3WSMenu }