Fixing the FMX menu loop bug on Windows

I’ve discovered a very simple bug in the implementation of FMX menu loops on Windows. This bug leads to what is in effect an Application.ProcessMessages loop in VCL terms, causing a CPU spike for the duration an FMX menu is shown. To fix, copy both FMX.Platform.Win.pas and to your project’s directory, open up the former, and work your way to line 1515 in TPlatformWin.StartMenuLoop. Then, replace

      if not FirstLoop then


      if FirstLoop then
        FirstLoop := False

Rebuild, and the spike should be gone.


3 thoughts on “Fixing the FMX menu loop bug on Windows

  1. I hope we will have an update pack soon, with such issues corrected.
    For a brand new release as the FireMonkey part, we may encounter several issues similar to this one.
    Not a stopper bug, just a CPU-consuming very annoying issue.

    • No I haven’t – at the time I posted, it wasn’t actually possible to create one for XE2. Feel free to create one yourself.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s