RESOLVED FIXED 167848
Static Analyzer: JSContext.mm: Incorrect decrement of the reference count of an object
https://bugs.webkit.org/show_bug.cgi?id=167848
Summary Static Analyzer: JSContext.mm: Incorrect decrement of the reference count of ...
Joseph Pecoraro
Reported 2017-02-04 17:36:21 PST
Static Analyzer: JSContext.mm: Incorrect decrement of the reference count of an object > Source/JavaScriptCore/API/JSContext.mm:87:5: warning: Incorrect decrement of the reference count of an object that is not owned at this point by the caller > [self.exceptionHandler release]; > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 1 warning generated. In practice this is normally harmless, but lets do the canonical thing here and just release the ivar instead of going through the getter.
Attachments
[PATCH] Proposed Fix (1.67 KB, patch)
2017-02-04 17:37 PST, Joseph Pecoraro
no flags
Joseph Pecoraro
Comment 1 2017-02-04 17:37:16 PST
Created attachment 300652 [details] [PATCH] Proposed Fix
Saam Barati
Comment 2 2017-02-05 12:35:30 PST
Comment on attachment 300652 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=300652&action=review > Source/JavaScriptCore/API/JSContext.mm:-50 > -@synthesize exceptionHandler; Is this auto generated? > Source/JavaScriptCore/API/JSContext.mm:85 > + [_exceptionHandler release]; Is this because the copy semantics of the getter?
Joseph Pecoraro
Comment 3 2017-02-06 10:51:38 PST
Comment on attachment 300652 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=300652&action=review >> Source/JavaScriptCore/API/JSContext.mm:-50 >> -@synthesize exceptionHandler; > > Is this auto generated? Yes, and the auto-generated version would be equivalent to: @synthesize exceptionHandler = _exceptionHandler; >> Source/JavaScriptCore/API/JSContext.mm:85 >> + [_exceptionHandler release]; > > Is this because the copy semantics of the getter? The idea here is that we just release our ivar directly instead of accessing it through the getter (which typically implies a memory neutral operation). The getter could even be overridden by a subclass that returns something else that isn't owned by this class, so invoking release would be incorrect. We don't own the value returned by the getter, but we own the ivar.
WebKit Commit Bot
Comment 4 2017-02-06 11:17:38 PST
Comment on attachment 300652 [details] [PATCH] Proposed Fix Clearing flags on attachment: 300652 Committed r211740: <http://trac.webkit.org/changeset/211740>
WebKit Commit Bot
Comment 5 2017-02-06 11:17:41 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.