<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>167848</bug_id>
          
          <creation_ts>2017-02-04 17:36:21 -0800</creation_ts>
          <short_desc>Static Analyzer: JSContext.mm: Incorrect decrement of the reference count of an object</short_desc>
          <delta_ts>2017-02-06 11:17:41 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Joseph Pecoraro">joepeck</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1273331</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2017-02-04 17:36:21 -0800</bug_when>
    <thetext>Static Analyzer: JSContext.mm: Incorrect decrement of the reference count of an object 

&gt; 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
&gt;     [self.exceptionHandler release];
&gt;     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&gt; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1273332</commentid>
    <comment_count>1</comment_count>
      <attachid>300652</attachid>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2017-02-04 17:37:16 -0800</bug_when>
    <thetext>Created attachment 300652
[PATCH] Proposed Fix</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1273417</commentid>
    <comment_count>2</comment_count>
      <attachid>300652</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-02-05 12:35:30 -0800</bug_when>
    <thetext>Comment on attachment 300652
[PATCH] Proposed Fix

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

&gt; Source/JavaScriptCore/API/JSContext.mm:-50
&gt; -@synthesize exceptionHandler;

Is this auto generated?

&gt; Source/JavaScriptCore/API/JSContext.mm:85
&gt; +    [_exceptionHandler release];

Is this because the copy semantics of the getter?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1273633</commentid>
    <comment_count>3</comment_count>
      <attachid>300652</attachid>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2017-02-06 10:51:38 -0800</bug_when>
    <thetext>Comment on attachment 300652
[PATCH] Proposed Fix

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

&gt;&gt; Source/JavaScriptCore/API/JSContext.mm:-50
&gt;&gt; -@synthesize exceptionHandler;
&gt; 
&gt; Is this auto generated?

Yes, and the auto-generated version would be equivalent to:

    @synthesize exceptionHandler = _exceptionHandler;

&gt;&gt; Source/JavaScriptCore/API/JSContext.mm:85
&gt;&gt; +    [_exceptionHandler release];
&gt; 
&gt; 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&apos;t owned by this class, so invoking release would be incorrect. We don&apos;t own the value returned by the getter, but we own the ivar.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1273644</commentid>
    <comment_count>4</comment_count>
      <attachid>300652</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-02-06 11:17:38 -0800</bug_when>
    <thetext>Comment on attachment 300652
[PATCH] Proposed Fix

Clearing flags on attachment: 300652

Committed r211740: &lt;http://trac.webkit.org/changeset/211740&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1273645</commentid>
    <comment_count>5</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-02-06 11:17:41 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>300652</attachid>
            <date>2017-02-04 17:37:16 -0800</date>
            <delta_ts>2017-02-06 11:17:38 -0800</delta_ts>
            <desc>[PATCH] Proposed Fix</desc>
            <filename>a-3.patch</filename>
            <type>text/plain</type>
            <size>1705</size>
            <attacher name="Joseph Pecoraro">joepeck</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9BUEkvSlNDb250ZXh0Lm1tIGIvU291
cmNlL0phdmFTY3JpcHRDb3JlL0FQSS9KU0NvbnRleHQubW0KaW5kZXggMzI5MTYyMmQxYTEuLmZk
OTMyZDQyNWI0IDEwMDY0NAotLS0gYS9Tb3VyY2UvSmF2YVNjcmlwdENvcmUvQVBJL0pTQ29udGV4
dC5tbQorKysgYi9Tb3VyY2UvSmF2YVNjcmlwdENvcmUvQVBJL0pTQ29udGV4dC5tbQpAQCAtNDcs
OCArNDcsNiBAQAogICAgIEpTQzo6U3Ryb25nPEpTQzo6SlNPYmplY3Q+IG1fZXhjZXB0aW9uOwog
fQogCi1Ac3ludGhlc2l6ZSBleGNlcHRpb25IYW5kbGVyOwotCiAtIChKU0dsb2JhbENvbnRleHRS
ZWYpSlNHbG9iYWxDb250ZXh0UmVmCiB7Ci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dW50IG9mIGFuIG9iamVjdCB0aGF0IGlzIG5vdCBv
d25lZCBhdCB0aGlzIHBvaW50IGJ5IHRoZSBjYWxsZXIKKyAgICAgICAgICAgIFtzZWxmLmV4Y2Vw
dGlvbkhhbmRsZXIgcmVsZWFzZV07CisgICAgICAgICAgICBefn5+fn5+fn5+fn5+fn5+fn5+fn5+
fn5+fn5+fn5+CisgICAgICAgIDEgd2FybmluZyBnZW5lcmF0ZWQuCisKKyAgICAgICAgKiBBUEkv
SlNDb250ZXh0Lm1tOgorICAgICAgICAoLVtKU0NvbnRleHQgZGVhbGxvY10pOgorICAgICAgICBV
c2UgdGhlIGl2YXIgaW4gZGVhbGxvYyBpbnN0ZWFkIG9mIGdvaW5nIHRocm91Z2ggdGhlIGdldHRl
ci4KKworMjAxNy0wMi0wNCAgSm9zZXBoIFBlY29yYXJvICA8cGVjb3Jhcm9AYXBwbGUuY29tPgor
CiAgICAgICAgIFN0YXRpYyBBbmFseXplcjogVmFsdWUgc3RvcmVkIHRvICdyZWNvcmRlZE1hY2hp
bmVUaHJlYWRzJyBkdXJpbmcgaXRzIGluaXRpYWxpemF0aW9uIGlzIG5ldmVyIHJlYWQKICAgICAg
ICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTE2Nzg0NQogCg==
</data>

          </attachment>
      

    </bug>

</bugzilla>