Title: [165478] trunk/Source/WebCore
- Revision
- 165478
- Author
- [email protected]
- Date
- 2014-03-12 10:44:27 -0700 (Wed, 12 Mar 2014)
Log Message
[Mac] Crash when running media/fallback.html test in MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification()
https://bugs.webkit.org/show_bug.cgi?id=130136
Reviewed by Eric Carlson.
MediaPlayerPrivateAVFoundation is trying to lock its m_queueMutex from an async thread after
while being destroyed in the main thread. To resolve this race condition, redispatch from
the async thread to the main thread, and use a WeakPtr to determine whether the object has
been destroyed or not.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::checkPlayability):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (165477 => 165478)
--- trunk/Source/WebCore/ChangeLog 2014-03-12 17:19:33 UTC (rev 165477)
+++ trunk/Source/WebCore/ChangeLog 2014-03-12 17:44:27 UTC (rev 165478)
@@ -1,3 +1,18 @@
+2014-03-12 Jer Noble <[email protected]>
+
+ [Mac] Crash when running media/fallback.html test in MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification()
+ https://bugs.webkit.org/show_bug.cgi?id=130136
+
+ Reviewed by Eric Carlson.
+
+ MediaPlayerPrivateAVFoundation is trying to lock its m_queueMutex from an async thread after
+ while being destroyed in the main thread. To resolve this race condition, redispatch from
+ the async thread to the main thread, and use a WeakPtr to determine whether the object has
+ been destroyed or not.
+
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::checkPlayability):
+
2014-03-12 Brent Fulgham <[email protected]>
[Win] Remove use of QTSDK
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (165477 => 165478)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2014-03-12 17:19:33 UTC (rev 165477)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2014-03-12 17:44:27 UTC (rev 165478)
@@ -224,7 +224,6 @@
}
-(id)initWithCallback:(MediaPlayerPrivateAVFoundationObjC*)callback;
-(void)disconnect;
--(void)playableKnown;
-(void)metadataLoaded;
-(void)didEnd:(NSNotification *)notification;
-(void)observeValueForKeyPath:keyPath ofObject:(id)object change:(NSDictionary *)change context:(MediaPlayerAVFoundationObservationContext)context;
@@ -719,9 +718,13 @@
m_haveCheckedPlayability = true;
LOG(Media, "MediaPlayerPrivateAVFoundationObjC::checkPlayability(%p)", this);
+ auto weakThis = createWeakPtr();
[m_avAsset.get() loadValuesAsynchronouslyForKeys:[NSArray arrayWithObject:@"playable"] completionHandler:^{
- [m_objcObserver.get() playableKnown];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (weakThis)
+ weakThis->scheduleMainThreadNotification(MediaPlayerPrivateAVFoundation::Notification::AssetPlayabilityKnown);
+ });
}];
}
@@ -2257,14 +2260,6 @@
m_callback->scheduleMainThreadNotification(MediaPlayerPrivateAVFoundation::Notification::AssetMetadataLoaded);
}
-- (void)playableKnown
-{
- if (!m_callback)
- return;
-
- m_callback->scheduleMainThreadNotification(MediaPlayerPrivateAVFoundation::Notification::AssetPlayabilityKnown);
-}
-
- (void)didEnd:(NSNotification *)unusedNotification
{
UNUSED_PARAM(unusedNotification);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes