Bug 182882 - [Cocoa][WebKitLegacy] REGRESSION(r221559): Coda 2 crashes when switching views
Summary: [Cocoa][WebKitLegacy] REGRESSION(r221559): Coda 2 crashes when switching views
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-02-16 13:28 PST by Brent Fulgham
Modified: 2018-02-16 13:57 PST (History)
5 users (show)

See Also:


Attachments
Patch (1.62 KB, patch)
2018-02-16 13:32 PST, Brent Fulgham
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2018-02-16 13:28:45 PST
The refactoring in Bug 176280 caused WebKit to attempt to message destroyed objects in WebKitLegacy applications.

A loop was moved (and rewritten) in the new implementation of (void)_web_makePluginSubviewsPerformSelector:(SEL)selector withObject:(id)object

The new code access subviews, copied them, placed them in a smart pointer, then retrieved the bare pointer for use in the Objective C iteration:

    for (NSView *view in adoptNS([[self subviews] copy]).get()) { ... }

This caused the collection being iterated over to be cleaned up during the loop, resulting in a crash.
Comment 1 Brent Fulgham 2018-02-16 13:28:56 PST
<rdar://problem/35672661>
Comment 2 Brent Fulgham 2018-02-16 13:32:28 PST
Created attachment 334064 [details]
Patch
Comment 3 mitz 2018-02-16 13:52:46 PST
Comment on attachment 334064 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=334064&action=review

> Source/WebKitLegacy/mac/WebView/WebHTMLView.mm:1430
> +    auto subViewsCopy = adoptNS([self.subviews copy]);

Lowercase v.
Comment 4 Brent Fulgham 2018-02-16 13:56:18 PST
Committed r228580: <https://trac.webkit.org/changeset/228580>
Comment 5 Brent Fulgham 2018-02-16 13:57:16 PST
Comment on attachment 334064 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=334064&action=review

>> Source/WebKitLegacy/mac/WebView/WebHTMLView.mm:1430
>> +    auto subViewsCopy = adoptNS([self.subviews copy]);
> 
> Lowercase v.

Will do! Thanks!