<?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>214999</bug_id>
          
          <creation_ts>2020-07-30 17:41:51 -0700</creation_ts>
          <short_desc>[WebGL2] Assert when restoring lost context</short_desc>
          <delta_ts>2020-08-03 13:38:08 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</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>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="James Darpinian">jdarpinian</reporter>
          <assigned_to name="James Darpinian">jdarpinian</assigned_to>
          <cc>cdumez</cc>
    
    <cc>changseok</cc>
    
    <cc>darin</cc>
    
    <cc>dino</cc>
    
    <cc>esprehn+autocc</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>graouts</cc>
    
    <cc>gyuyoung.kim</cc>
    
    <cc>kondapallykalyan</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1676661</commentid>
    <comment_count>0</comment_count>
    <who name="James Darpinian">jdarpinian</who>
    <bug_when>2020-07-30 17:41:51 -0700</bug_when>
    <thetext>[WebGL2] Assert when restoring lost context</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1676662</commentid>
    <comment_count>1</comment_count>
      <attachid>405644</attachid>
    <who name="James Darpinian">jdarpinian</who>
    <bug_when>2020-07-30 17:42:34 -0700</bug_when>
    <thetext>Created attachment 405644
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1676683</commentid>
    <comment_count>2</comment_count>
      <attachid>405644</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-07-30 19:10:09 -0700</bug_when>
    <thetext>Comment on attachment 405644
Patch

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

&gt; Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:215
&gt; +    // If we&apos;re restoring a lost context, we should delete the old default VAO before creating the new one.
&gt; +    m_defaultVertexArrayObject = nullptr;

This points to a design problem. Decrementing the reference count on a reference counted object is not guaranteed to delete the object. If we need control of timing of object deletion then it’s not good to be using reference counted objects.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1676684</commentid>
    <comment_count>3</comment_count>
      <attachid>405644</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-07-30 19:11:20 -0700</bug_when>
    <thetext>Comment on attachment 405644
Patch

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

&gt;&gt; Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:215
&gt;&gt; +    m_defaultVertexArrayObject = nullptr;
&gt; 
&gt; This points to a design problem. Decrementing the reference count on a reference counted object is not guaranteed to delete the object. If we need control of timing of object deletion then it’s not good to be using reference counted objects.

I suppose we could just write in a comment here the reason why we are guaranteed there is no one else holding a reference to this. Or we could come up with a way to do the deletion explicitly other than destroying the C++ reference counted thing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1676751</commentid>
    <comment_count>4</comment_count>
      <attachid>405644</attachid>
    <who name="James Darpinian">jdarpinian</who>
    <bug_when>2020-07-31 00:02:36 -0700</bug_when>
    <thetext>Comment on attachment 405644
Patch

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

&gt;&gt;&gt; Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:215
&gt;&gt;&gt; +    m_defaultVertexArrayObject = nullptr;
&gt;&gt; 
&gt;&gt; This points to a design problem. Decrementing the reference count on a reference counted object is not guaranteed to delete the object. If we need control of timing of object deletion then it’s not good to be using reference counted objects.
&gt; 
&gt; I suppose we could just write in a comment here the reason why we are guaranteed there is no one else holding a reference to this. Or we could come up with a way to do the deletion explicitly other than destroying the C++ reference counted thing.

Sorry, &quot;delete&quot; is the wrong word. The object does not need to be deleted, it just needs to be disassociated from the context. I will fix the comment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1676877</commentid>
    <comment_count>5</comment_count>
      <attachid>405644</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-07-31 11:04:13 -0700</bug_when>
    <thetext>Comment on attachment 405644
Patch

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

&gt;&gt;&gt;&gt; Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:215
&gt;&gt;&gt;&gt; +    m_defaultVertexArrayObject = nullptr;
&gt;&gt;&gt; 
&gt;&gt;&gt; This points to a design problem. Decrementing the reference count on a reference counted object is not guaranteed to delete the object. If we need control of timing of object deletion then it’s not good to be using reference counted objects.
&gt;&gt; 
&gt;&gt; I suppose we could just write in a comment here the reason why we are guaranteed there is no one else holding a reference to this. Or we could come up with a way to do the deletion explicitly other than destroying the C++ reference counted thing.
&gt; 
&gt; Sorry, &quot;delete&quot; is the wrong word. The object does not need to be deleted, it just needs to be disassociated from the context. I will fix the comment.

I’d like to understand what &quot;disassociated&quot; means. Does it literally just mean that m_defaultVertexArrayObject must be null?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1676878</commentid>
    <comment_count>6</comment_count>
      <attachid>405644</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-07-31 11:04:44 -0700</bug_when>
    <thetext>Comment on attachment 405644
Patch

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

&gt;&gt;&gt;&gt;&gt; Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:215
&gt;&gt;&gt;&gt;&gt; +    m_defaultVertexArrayObject = nullptr;
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; This points to a design problem. Decrementing the reference count on a reference counted object is not guaranteed to delete the object. If we need control of timing of object deletion then it’s not good to be using reference counted objects.
&gt;&gt;&gt; 
&gt;&gt;&gt; I suppose we could just write in a comment here the reason why we are guaranteed there is no one else holding a reference to this. Or we could come up with a way to do the deletion explicitly other than destroying the C++ reference counted thing.
&gt;&gt; 
&gt;&gt; Sorry, &quot;delete&quot; is the wrong word. The object does not need to be deleted, it just needs to be disassociated from the context. I will fix the comment.
&gt; 
&gt; I’d like to understand what &quot;disassociated&quot; means. Does it literally just mean that m_defaultVertexArrayObject must be null?

Could you clarify what the specific issue is? I understand roughly but not fully.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1677017</commentid>
    <comment_count>7</comment_count>
      <attachid>405644</attachid>
    <who name="James Darpinian">jdarpinian</who>
    <bug_when>2020-07-31 15:48:31 -0700</bug_when>
    <thetext>Comment on attachment 405644
Patch

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

&gt;&gt;&gt;&gt;&gt;&gt; Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:215
&gt;&gt;&gt;&gt;&gt;&gt; +    m_defaultVertexArrayObject = nullptr;
&gt;&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt;&gt; This points to a design problem. Decrementing the reference count on a reference counted object is not guaranteed to delete the object. If we need control of timing of object deletion then it’s not good to be using reference counted objects.
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; I suppose we could just write in a comment here the reason why we are guaranteed there is no one else holding a reference to this. Or we could come up with a way to do the deletion explicitly other than destroying the C++ reference counted thing.
&gt;&gt;&gt; 
&gt;&gt;&gt; Sorry, &quot;delete&quot; is the wrong word. The object does not need to be deleted, it just needs to be disassociated from the context. I will fix the comment.
&gt;&gt; 
&gt;&gt; I’d like to understand what &quot;disassociated&quot; means. Does it literally just mean that m_defaultVertexArrayObject must be null?
&gt; 
&gt; Could you clarify what the specific issue is? I understand roughly but not fully.

There&apos;s just an assert in WebGLVertexArrayObject::create that m_defaultVertexArrayObject is null when creating an object with Type::Default, I suppose to prevent people accidentally specifying Type::Default when they didn&apos;t mean to. Since that seems unlikely, an alternative approach would be to simply remove the assert.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1677062</commentid>
    <comment_count>8</comment_count>
      <attachid>405763</attachid>
    <who name="James Darpinian">jdarpinian</who>
    <bug_when>2020-07-31 17:35:46 -0700</bug_when>
    <thetext>Created attachment 405763
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1677348</commentid>
    <comment_count>9</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2020-08-03 10:49:19 -0700</bug_when>
    <thetext>Committed r265205: &lt;https://trac.webkit.org/changeset/265205&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 405763.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1677407</commentid>
    <comment_count>10</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-08-03 13:38:08 -0700</bug_when>
    <thetext>&lt;rdar://problem/66489320&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>405644</attachid>
            <date>2020-07-30 17:42:34 -0700</date>
            <delta_ts>2020-07-31 17:35:44 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-214999-20200730174234.patch</filename>
            <type>text/plain</type>
            <size>1712</size>
            <attacher name="James Darpinian">jdarpinian</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjY1MDkxCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggOGY1NzJjYjI4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N0KTsKICNpZiBVU0UoT1BFTkdMX0VT
KQo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>405763</attachid>
            <date>2020-07-31 17:35:46 -0700</date>
            <delta_ts>2020-08-03 10:49:20 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-214999-20200731173545.patch</filename>
            <type>text/plain</type>
            <size>1560</size>
            <attacher name="James Darpinian">jdarpinian</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjY1MDkxCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggOGY1NzJjYjI4Yjg4MDFj
ODViNzk2MDU2MmFhZTZjOGMwY2Q4NDhiYy4uMGE0NTQ4ZDdhZWY2ODZhZTM0MDJkNGI2ZTQ3MTFi
ZDU2MjcxNWRiYiAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE1IEBACisyMDIwLTA3LTMwICBKYW1l
cyBEYXJwaW5pYW4gIDxqZGFycGluaWFuQGNocm9taXVtLm9yZz4KKworICAgICAgICBbV2ViR0wy
XSBBc3NlcnQgd2hlbiByZXN0b3JpbmcgbG9zdCBjb250ZXh0CisgICAgICAgIGh0dHBzOi8vYnVn
cy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0yMTQ5OTkKKworICAgICAgICBSZXZpZXdlZCBi
eSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAgICBSZW1vdmUgYW4gYXNzZXJ0IHRoYXQgd2FzIHdy
b25nIHdoZW4gcmVzdG9yaW5nIGEgbG9zdCBjb250ZXh0LgorCisgICAgICAgICogaHRtbC9jYW52
YXMvV2ViR0wyUmVuZGVyaW5nQ29udGV4dC5jc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