<?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>179792</bug_id>
          
          <creation_ts>2017-11-16 13:03:46 -0800</creation_ts>
          <short_desc>Fix occasional crash when adding and removing videos</short_desc>
          <delta_ts>2017-11-27 15:39:34 -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>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="Alex Christensen">achristensen</reporter>
          <assigned_to name="Alex Christensen">achristensen</assigned_to>
          <cc>ggaren</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1372770</commentid>
    <comment_count>0</comment_count>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2017-11-16 13:03:46 -0800</bug_when>
    <thetext>Fix occasional crash when adding and removing videos</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1372771</commentid>
    <comment_count>1</comment_count>
      <attachid>327097</attachid>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2017-11-16 13:06:16 -0800</bug_when>
    <thetext>Created attachment 327097
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1372891</commentid>
    <comment_count>2</comment_count>
      <attachid>327097</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2017-11-16 16:48:31 -0800</bug_when>
    <thetext>Comment on attachment 327097
Patch

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

r=me

&gt; Source/WebCore/ChangeLog:11
&gt; +        Right now we are calling a method on self.session.loader which is a PlatformMediaResourceLoader&amp;
&gt; +        but in ObjC if session is null it will call a method on null, which crashes.

I don&apos;t understand this explanation. A message to nil is well-defined in Objective-C: it returns a zero value and does not crash. 

Maybe the actual problem is that _restart calls the C++ member function requestResource, passing nullptr as the |this| value. Is the the case?

Would be good to fix this explanation.

&gt; Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm:451
&gt; +    if (!self.session)
&gt; +        return;
&gt; +
&gt;      ASSERT(isMainThread());
&gt;      [self _cancel];

Should we put the ASSERT at the top so we don&apos;t skip it in the null session case?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1372976</commentid>
    <comment_count>3</comment_count>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2017-11-16 21:50:51 -0800</bug_when>
    <thetext>(In reply to Geoffrey Garen from comment #2)
&gt; I don&apos;t understand this explanation. A message to nil is well-defined in
&gt; Objective-C: it returns a zero value and does not crash. 
&gt; 
&gt; Maybe the actual problem is that _restart calls the C++ member function
&gt; requestResource, passing nullptr as the |this| value. Is the the case?
That&apos;s exactly what&apos;s going on.

&gt; Would be good to fix this explanation.
I did.

&gt; &gt; Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm:451
&gt; &gt; +    if (!self.session)
&gt; &gt; +        return;
&gt; &gt; +
&gt; &gt;      ASSERT(isMainThread());
&gt; &gt;      [self _cancel];
&gt; 
&gt; Should we put the ASSERT at the top so we don&apos;t skip it in the null session
&gt; case?
Good idea!  Done.

http://trac.webkit.org/r224960</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1372977</commentid>
    <comment_count>4</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2017-11-16 21:51:16 -0800</bug_when>
    <thetext>&lt;rdar://problem/35608458&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1373270</commentid>
    <comment_count>5</comment_count>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2017-11-17 13:52:37 -0800</bug_when>
    <thetext>rdar://problem/35485349</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1375182</commentid>
    <comment_count>6</comment_count>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2017-11-27 15:39:34 -0800</bug_when>
    <thetext>rdar://problem/28992186</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>327097</attachid>
            <date>2017-11-16 13:06:16 -0800</date>
            <delta_ts>2017-11-16 16:48:31 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-179792-20171116130615.patch</filename>
            <type>text/plain</type>
            <size>1509</size>
            <attacher name="Alex Christensen">achristensen</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDIyNDkzNCkKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE5IEBACisyMDE3LTExLTE2ICBBbGV4IENo
cmlzdGVuc2VuICA8YWNocmlzdGVuc2VuQHdlYmtpdC5vcmc+CisKKyAgICAgICAgRml4IG9jY2Fz
aW9uYWwgY3Jhc2ggd2hlbiBhZGRpbmcgYW5kIHJlbW92aW5nIHZpZGVvcworICAgICAgICBodHRw
czovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MTc5NzkyCisKKyAgICAgICAgUmV2
aWV3ZWQg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L2NvY29hL1dlYkNvcmVOU1VSTFNlc3Npb24ubW0JKHJldmlzaW9uIDIyNDg5
NSkKKysrIFNvdXJjZS9XZWJDb3JlL3BsYXRmb3JtL25ldHdvcmsvY29jb2EvV2ViQ29yZU5TVVJM
U2Vzc2lvbi5tbQkod29ya2luZyBjb3B5KQpAQCAtNDQ0LDYgKzQ0NCw5IEBAIC0gKGlkKWNvcHlX
aXRoWm9uZTooTlNab25lICopem9uZQogCiAtICh2b2lkKV9yZXN0YXJ0CiB7CisgICAgaWYgKCFz
ZWxmLnNlc3Npb24pCisgICAgICAgIHJldHVybjsKKwogICAgIEFTU0VSVChpc01haW5UaHJlYWQo
KSk7CiAgICAgW3NlbGYgX2NhbmNlbF07CiAK
</data>
<flag name="review"
          id="346341"
          type_id="1"
          status="+"
          setter="ggaren"
    />
          </attachment>
      

    </bug>

</bugzilla>