Title: [240076] branches/safari-607-branch/Source/WebCore
Revision
240076
Author
[email protected]
Date
2019-01-16 15:28:11 -0800 (Wed, 16 Jan 2019)

Log Message

Cherry-pick r239889. rdar://problem/47260233

    REGRESSION(r239419): Crash in AudioSourceProviderAVFObjC::~AudioSourceProviderAVFObjC()
    https://bugs.webkit.org/show_bug.cgi?id=193342
    <rdar://problem/47119836>

    Reviewed by Eric Carlson.

    Make the TapStorage used by AudioSourceProviderAVFObjC thread-safe RefCounted.

    * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
    * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
    (WebCore::AudioSourceProviderAVFObjC::initCallback):
    (WebCore::AudioSourceProviderAVFObjC::finalizeCallback):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239889 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (240075 => 240076)


--- branches/safari-607-branch/Source/WebCore/ChangeLog	2019-01-16 23:28:07 UTC (rev 240075)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog	2019-01-16 23:28:11 UTC (rev 240076)
@@ -1,5 +1,40 @@
 2019-01-15  Alan Coon  <[email protected]>
 
+        Cherry-pick r239889. rdar://problem/47260233
+
+    REGRESSION(r239419): Crash in AudioSourceProviderAVFObjC::~AudioSourceProviderAVFObjC()
+    https://bugs.webkit.org/show_bug.cgi?id=193342
+    <rdar://problem/47119836>
+    
+    Reviewed by Eric Carlson.
+    
+    Make the TapStorage used by AudioSourceProviderAVFObjC thread-safe RefCounted.
+    
+    * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
+    * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
+    (WebCore::AudioSourceProviderAVFObjC::initCallback):
+    (WebCore::AudioSourceProviderAVFObjC::finalizeCallback):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239889 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-01-11  Jer Noble  <[email protected]>
+
+            REGRESSION(r239419): Crash in AudioSourceProviderAVFObjC::~AudioSourceProviderAVFObjC()
+            https://bugs.webkit.org/show_bug.cgi?id=193342
+            <rdar://problem/47119836>
+
+            Reviewed by Eric Carlson.
+
+            Make the TapStorage used by AudioSourceProviderAVFObjC thread-safe RefCounted.
+
+            * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
+            * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
+            (WebCore::AudioSourceProviderAVFObjC::initCallback):
+            (WebCore::AudioSourceProviderAVFObjC::finalizeCallback):
+
+2019-01-15  Alan Coon  <[email protected]>
+
         Cherry-pick r239888. rdar://problem/47260286
 
     Compile out Web API Statistics Collection

Modified: branches/safari-607-branch/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h (240075 => 240076)


--- branches/safari-607-branch/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h	2019-01-16 23:28:07 UTC (rev 240075)
+++ branches/safari-607-branch/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h	2019-01-16 23:28:11 UTC (rev 240076)
@@ -98,8 +98,8 @@
     bool m_paused { true };
     AudioSourceProviderClient* m_client { nullptr };
 
-    struct TapStorage;
-    TapStorage* m_tapStorage { nullptr };
+    class TapStorage;
+    RefPtr<TapStorage> m_tapStorage;
 };
     
 }

Modified: branches/safari-607-branch/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm (240075 => 240076)


--- branches/safari-607-branch/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm	2019-01-16 23:28:07 UTC (rev 240075)
+++ branches/safari-607-branch/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm	2019-01-16 23:28:11 UTC (rev 240076)
@@ -69,7 +69,8 @@
 using namespace PAL;
 static const double kRingBufferDuration = 1;
 
-struct AudioSourceProviderAVFObjC::TapStorage {
+class AudioSourceProviderAVFObjC::TapStorage : public ThreadSafeRefCounted<AudioSourceProviderAVFObjC::TapStorage> {
+public:
     TapStorage(AudioSourceProviderAVFObjC* _this) : _this(_this) { }
     AudioSourceProviderAVFObjC* _this;
     Lock mutex;
@@ -238,9 +239,12 @@
     ASSERT(tap);
     AudioSourceProviderAVFObjC* _this = static_cast<AudioSourceProviderAVFObjC*>(clientInfo);
     _this->m_tap = adoptCF(tap);
-    _this->m_tapStorage = new TapStorage(_this);
+    _this->m_tapStorage = adoptRef(new TapStorage(_this));
     _this->init(clientInfo, tapStorageOut);
-    *tapStorageOut = _this->m_tapStorage;
+    *tapStorageOut = _this->m_tapStorage.get();
+
+    // ref balanced by deref in finalizeCallback:
+    _this->m_tapStorage->ref();
 }
 
 void AudioSourceProviderAVFObjC::finalizeCallback(MTAudioProcessingTapRef tap)
@@ -253,7 +257,7 @@
         if (tapStorage->_this)
             tapStorage->_this->finalize();
     }
-    delete tapStorage;
+    tapStorage->deref();
 }
 
 void AudioSourceProviderAVFObjC::prepareCallback(MTAudioProcessingTapRef tap, CMItemCount maxFrames, const AudioStreamBasicDescription *processingFormat)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to