[BR] Restoring window bounds on second monitor incorrectly reverts to main monitor

There appears to be an issue with window bounds being saved when a window is closed and reopened on a second monitor. The window tends to reopen on the main monitor, even when it is closed on the second monitor. I have been able to replicate this issue in a simple JUCE demo. I assume that the window’s state is not being saved correctly.

Steps to reproduce:

  1. Swap JUCE examples/GUI/WindowDemo.h with our file
  2. Open the DemoRunner and run the Windows example
  3. Open the window with the button labelled “bug”
  4. Move the generated window to the second monitor and maximize it
  5. Repeatedly close and open the window
  6. At some point, you’ll see the window incorrectly opens on the main monitor
  7. Note the bounds string before this happens is correctly the bounds for the second monitor

WindowsDemo.h (12.7 KB)

Please can you let us know on which platform you’re observing the problem (macOS, Windows, Linux), along with the platform’s version. Thanks!

macOS Big Sur and Windows 10. Hope this helps.