Call to menuItemsChanged() on MacOS not updating menu item if open


#1

Hi there,

I'm experiencing an issue with my menu updates on MacOS.

Whenever a menu is likely to have changed its items I am calling menuItemsChanged(), which works just fine, except in the case when any of the menus from the menu bar is open at the time of the update call.

I've checked the code of MainMenuHandler::menuBarItemsChanged(), which just returns in case it is open.

Is this a known issue or am I doing something wrong?

 

Thanks in advance!


#2

Hello,

Could you provide some minimal code to reproduce your problem? That would make it easier to understand what the issue is :)


#3

It's a bit tricky to isolate some code as this is part of a bigger project but here's the idea:

  1. An instance of MenuBarItem calls menuItemsChanged()
  2. This triggers an async message which eventually ends up calling JuceMainMenuHandler::menuBarItemsChanged()
  3. Within that function if the menu is open, the function will just return, so the update will never take place

​I was expecting the menu to be updated once it's reopened that won't happen.


#4

I've just pushed a fix for this, please update to the latest tip! :)


#5

Thanks a lot for that!