[webkit-reviews] review granted: [Bug 189455] Streamline JSRetainPtr, fix leaks of JSString and JSGlobalContext : [Attachment 349279] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Sep 10 13:28:30 PDT 2018
Keith Miller <keith_miller at apple.com> has granted Darin Adler
<darin at apple.com>'s request for review:
Bug 189455: Streamline JSRetainPtr, fix leaks of JSString and JSGlobalContext
https://bugs.webkit.org/show_bug.cgi?id=189455
Attachment 349279: Patch
https://bugs.webkit.org/attachment.cgi?id=349279&action=review
--- Comment #11 from Keith Miller <keith_miller at apple.com> ---
Comment on attachment 349279
--> https://bugs.webkit.org/attachment.cgi?id=349279
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=349279&action=review
r=me with comments. I think you need to rebase though.
> Source/JavaScriptCore/API/JSObjectRef.cpp:796
> +
propertyNames->array.uncheckedAppend(adopt(OpaqueJSString::create(array[i].stri
ng()).leakRef()));
What's the point of adopting the string then leaking it?
> Source/JavaScriptCore/API/JSRetainPtr.h:69
> + // FIXME: Make this private once Apple's internal code is updated to not
rely on it.
nit: Could you file a bugzilla for this and link to it in the FIXME?
> Source/JavaScriptCore/API/JSValue.mm:159
> + JSStringRef string = JSStringCreateWithCFString((__bridge
CFStringRef)description);
> + auto value = [JSValue valueWithJSValueRef:JSValueMakeSymbol([context
JSGlobalContextRef], string) inContext:context];
> + JSStringRelease(string);
Aww man, I'm so used to RAII lifetime management that I completely missed this!
:( Good catch.
Maybe we should use RetainPtr in this file so we don't make these mistakes
again?
More information about the webkit-reviews
mailing list