Strange crash and fix in getCurrentModifiersRealtime

3 posts / 0 new
Last post
ckk
Offline
Last seen: 13 hours 36 min ago
Joined: 20 May 2010 - 19:43
Strange crash and fix in getCurrentModifiersRealtime

Hi Jules,

we ran into a very strange crash in one of our applications and plugins when the mouse moves over a ComboBox popup menu (the item list for selection) while a modifier key is pressed. The crash occured in getCurrentModifiersRealtime(), but we weren't ably to make a simple application with only a ComboBox that reproduces the crash.

What fixed the crash is changing

ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
{
    if ([NSEvent respondsToSelector: @selector (modifierFlags)])
        NSViewComponentPeer::updateModifiers ([NSEvent modifierFlags]);
to
ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
{
    if ([NSEvent respondsToSelector: @selector (modifierFlags)])
        NSViewComponentPeer::updateModifiers ((NSUInteger) [NSEvent modifierFlags]);
(Casting [NSEvent modifierFlags] to NSUInteger)
in juce_mac_NSViewComponentPeer.mm.

Not sure if this is really needed with the current juce version (we're using an older one; ~2.0.18), but it shouldn't break anything either.

Chris

jules
Offline
Last seen: 11 hours 42 min ago
Joined: 29 Apr 2013 - 18:37
Re: Strange crash and fix in getCurrentModifiersRealtime

Thanks - although this is something I already fixed a couple of weeks ago!

ckk
Offline
Last seen: 13 hours 36 min ago
Joined: 20 May 2010 - 19:43
Re: Strange crash and fix in getCurrentModifiersRealtime

I did have a look at the current juce tip, but obviously I overlooked that. :oops:

Chris