• Trent Apted's avatar
    MacViews: Always null-check BridgedContentView's textInputClient_ · 9fc16442
    Trent Apted authored
    When a real IME window is up, AppKit spins a nested runloop that
    interacts with the IME window over XPC while we're trying to
    invalidate our NSTextInputClient (e.g. because the window has been
    deleted). However, this may also cause AppKit to *use* the very
    NSTextInputClient that we're trying to invalidate.
    
    Specifically, this seems to happen with phonetic languages such as
    Korean and Vietnamese. These use rule-based transforms that do not
    commonly pop-up a candidate window. In such cases, a key such as
    Enter may simultaneously commit a composition _and_ trigger the omnibox
    action, which moves focus away from the omnibox thereby invalidating
    the textInputClient_.
    
    -BridgedContentView insertText: was the last hold-out that didn't
    have a null check. AttributedSubstringForRangeHelper() and
    GetFirstRectForRangeHelper() handle a null client already.
    
      SystemPreferences -> Keyboard -> Input Sources, then interact with
      the omnibox.
    
    Test: On Mac, add/enable the "2-Set Korean" input method under
    Bug: 817097
    Change-Id: Ia7d1ebb796b9c98437b563ea405cad785e92ea30
    Reviewed-on: https://chromium-review.googlesource.com/1124073Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
    Commit-Queue: Trent Apted <tapted@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#572396}
    9fc16442
bridged_content_view.mm 53.4 KB