Hi all,
Since updating to JUCE 6.1.3 I keep getting a read access violation exception. At first, I thought it was an issue with our code, but I’m able to reproduce it in DemoRunner too.
Steps:
- Build/run JUCE 6.1.3 DemoRunner on Windows (I’m using VS2019).
- Go to
Browse Demos
→GUI
→WidgetsDemo.h
→Menus
. - Click the
Nested Sub-Menus
button. - Use the keyboard from this point onwards.
- Press the down arrow to highlight
Item 0
. - Press the right arrow to open the
Item 0
submenu. - Press the right arrow again to open the
Sub-item 0
submenu. - Press the left arrow twice to close the submenus.
- If it works OK, repeat steps 3-8 a few times (it happens about 60% of the time for me).
Expected:
Submenus close as expected.
Actual:
Read access violation exception thrown (“peer-> was 0xFFFFFFFFFFFFFF37”) on juce_ModalComponentManager.cpp line 237.
Some investigation suggests that juce::PopupMenu::HelperClasses::MenuWindow::keyPressed(key == KeyPress::leftKey)
is using a MenuWindow
object that was deleted by a call to hide()
/exitModalState()
. See juce_PopupMenu.cpp line 575. Using a juce::WeakReference
deletion checker in that context avoids the crash.
FWIW, I haven’t tried it on Mac yet, nor have I verified that it wasn’t already a problem in earlier JUCE releases (I just happened to notice it when testing after updating to 6.1.3).
Thanks,
Ben Staton