Changeset 260545 in webkit


Ignore:
Timestamp:
Apr 22, 2020 5:27:58 PM (4 years ago)
Author:
Darin Adler
Message:

[Cocoa] REGRESSION (r260485): Crash in Legacy WebKit createMenu item function (reproducible under Asan)
https://bugs.webkit.org/show_bug.cgi?id=210888

Reviewed by Alex Christensen.

  • WebView/WebHTMLView.mm:

(createMenuItem): Speculative fix: Go back to using a local variable. Apparently
the Objective-C for loop doesn't extend the lifetime of its argument the way the
C++ range-based for loop does, so the local variable is needed.

Location:
trunk/Source/WebKitLegacy/mac
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r260486 r260545  
     12020-04-22  Darin Adler  <darin@apple.com>
     2
     3        [Cocoa] REGRESSION (r260485): Crash in Legacy WebKit createMenu item function (reproducible under Asan)
     4        https://bugs.webkit.org/show_bug.cgi?id=210888
     5
     6        Reviewed by Alex Christensen.
     7
     8        * WebView/WebHTMLView.mm:
     9        (createMenuItem): Speculative fix: Go back to using a local variable. Apparently
     10        the Objective-C for loop doesn't extend the lifetime of its argument the way the
     11        C++ range-based for loop does, so the local variable is needed.
     12
    1132020-04-21  Peng Liu  <peng.liu6@apple.com>
    214
  • trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm

    r260485 r260545  
    36733673    case WebCore::SubmenuType: {
    36743674        auto menu = adoptNS([[NSMenu alloc] init]);
    3675 
    3676         for (NSMenuItem *menuItem in createMenuItems(hitTestResult, item.subMenuItems()).get())
    3677             [menu addItem:menuItem];
     3675        {
     3676            auto submenuItems = createMenuItems(hitTestResult, item.subMenuItems());
     3677            for (NSMenuItem *menuItem in submenuItems.get())
     3678                [menu addItem:menuItem];
     3679        }
    36783680
    36793681        auto menuItem = adoptNS([[NSMenuItem alloc] initWithTitle:item.title() action:nullptr keyEquivalent:@""]);
Note: See TracChangeset for help on using the changeset viewer.