<?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>224480</bug_id>
          
          <creation_ts>2021-04-13 05:12:45 -0700</creation_ts>
          <short_desc>Remove the comment in ~AudioSourceProviderAVFObjC about undefined behavior</short_desc>
          <delta_ts>2021-04-20 05:13:15 -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>Media</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>ASSIGNED</bug_status>
          <resolution></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>
          <dependson>224230</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kimmo Kinnunen">kkinnunen</reporter>
          <assigned_to name="Kimmo Kinnunen">kkinnunen</assigned_to>
          <cc>ap</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1749655</commentid>
    <comment_count>0</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2021-04-13 05:12:45 -0700</bug_when>
    <thetext>AudioSourceProviderAVFObjC locks a mutex in destructor.
This is undefined behavior, since the mutex controls access to the object members.
Since the object cannot have multiple active references during destruction, mutex locking should not be needed.
However, it is needed, and as such this indicates undefined behavior.´</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1749887</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2021-04-13 15:01:25 -0700</bug_when>
    <thetext>&gt; This is undefined behavior, since the mutex controls access to the object members.

Object members are destroyed after the destructor runs, so I don&apos;t see a problem with this code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750265</commentid>
    <comment_count>2</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2021-04-14 12:03:49 -0700</bug_when>
    <thetext>&gt; &gt; This is undefined behavior, since the mutex controls access to the object members.
&gt; 
&gt; Object members are destroyed after the destructor runs, so I don&apos;t see a
&gt; problem with this code.

Yeah, you&apos;re right. I took a bit of a mental shortcut, thinking about the case where the mutex would be moved to the class for more logical operation. 

I&apos;ll use this bug to remove the comment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750267</commentid>
    <comment_count>3</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2021-04-14 12:08:11 -0700</bug_when>
    <thetext>Ah, no, maybe not. I think the issue still stands.

&gt; Object members are destroyed after the destructor runs, so I don&apos;t see a problem with this code.


It&apos;s not about destroying the members.

The bug is about what C++ defines as being &quot;well-formed program&quot;.

I think I recall, and it sort of makes sense, that a well-formed program cannot have the execution in destructor and a member function at the same time. In practice it works, as the data members are destroyed after end of the destructor. However, typically one should not rely on &quot;in practice it works&quot; if it&apos;s contrary to the soundness definition of the language.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750278</commentid>
    <comment_count>4</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2021-04-14 12:28:51 -0700</bug_when>
    <thetext>Clarified it: I was remembering and thinking wrong.
So I&apos;ll remove the comment in the destructor.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1752229</commentid>
    <comment_count>5</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-04-20 05:13:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/76894075&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>