[Webkit-unassigned] [Bug 138032] WebKit1 should support action menus

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 24 13:10:05 PDT 2014


https://bugs.webkit.org/show_bug.cgi?id=138032

--- Comment #7 from mitz at webkit.org <mitz at webkit.org> ---
Comment on attachment 240381
  --> https://bugs.webkit.org/attachment.cgi?id=240381
Patch

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

>>> Source/WebKit/mac/WebView/WebActionMenuHelper.mm:62
>>> +    _webView = webView;
>> 
>> Like I asked Tim in the other patch: what keeps us from using this ivar after the WebView is deallocated?
> 
> Hopefully this whole class will be deallocated while the WebView is being deallocated. WebViewData has the reference to the WebActionMenuHelper, and the WebView releases the WebViewData in its dealloc, and the WebViewData releases the WebActionMenuHelper in its dealloc. So I think we're okay, but please correct me if I am wrong.

My point is more that there are no hard guarantees about object lifetimes in Objective-C. Even if the WebViewData is released, and even if that release causes it to be deallocated, and that causes the helper to be released, it’s still possible that the helper won’t be deallocated immediately, because some other object got a strong reference to it, or it found its way into an autorelease pool. In practice, perhaps this won’t matter because at least we know that once the WebView is gone, nothing can message the helper and cause it to do anything that references the WebView. If we weren’t (or aren’t) sure of that, we could do something safer and have an explicit way for the WebView’s -dealloc (or -close) to tell the helper that it’s going away.

>>> Source/WebKit/mac/WebView/WebActionMenuHelper.mm:191
>>> +    return [[NSBundle bundleForClass:[WebView class]] imageForResource:name];
>> 
>> If you changed this to [WKView class], then it would look in the WebKit.framework bundle (rather than the WebKitLegacy.framework bundle) and you wouldn’t need to add the image to this project at all!
> 
> WebKit did not want to build with this because it didn't know what a WKView does. Should I do something to forward declare it? Is that okay?

No need to forward declare, just NSClassFromString() it!

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20141024/1b0aabbd/attachment-0002.html>


More information about the webkit-unassigned mailing list