TextTrackMenu crashes in ports where MediaElement players are lazily created
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 May 2013 19:55:31 +0000 (19:55 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 May 2013 19:55:31 +0000 (19:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=115485

Null check the player for ports, like iOS, that lazily create the player.

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2013-05-01
Reviewed by Eric Carlson.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::platformTextTrackMenu):
(WebCore::HTMLMediaElement::closeCaptionTracksChanged):

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

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp

index 3e7d017..9facdcd 100644 (file)
@@ -1,3 +1,16 @@
+2013-05-01  Joseph Pecoraro  <pecoraro@apple.com>
+
+        TextTrackMenu crashes in ports where MediaElement players are lazily created
+        https://bugs.webkit.org/show_bug.cgi?id=115485
+
+        Null check the player for ports, like iOS, that lazily create the player.
+
+        Reviewed by Eric Carlson.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::platformTextTrackMenu):
+        (WebCore::HTMLMediaElement::closeCaptionTracksChanged):
+
 2013-05-01  Anders Carlsson  <andersca@apple.com>
 
         Add FunctionDispatcher class and make RunLoop derive from it
 2013-05-01  Anders Carlsson  <andersca@apple.com>
 
         Add FunctionDispatcher class and make RunLoop derive from it
index d6d58d9..7837820 100644 (file)
@@ -2938,7 +2938,7 @@ PlatformTextTrackMenuInterface* HTMLMediaElement::platformTextTrackMenu()
     if (m_platformMenu)
         return m_platformMenu.get();
 
     if (m_platformMenu)
         return m_platformMenu.get();
 
-    if (!m_player->implementsTextTrackControls())
+    if (!m_player || !m_player->implementsTextTrackControls())
         return 0;
 
     m_platformMenu = m_player->textTrackMenu();
         return 0;
 
     m_platformMenu = m_player->textTrackMenu();
@@ -2957,7 +2957,7 @@ void HTMLMediaElement::closeCaptionTracksChanged()
         mediaControls()->closedCaptionTracksChanged();
 
 #if USE(PLATFORM_TEXT_TRACK_MENU)
         mediaControls()->closedCaptionTracksChanged();
 
 #if USE(PLATFORM_TEXT_TRACK_MENU)
-    if (m_player->implementsTextTrackControls())
+    if (m_player && m_player->implementsTextTrackControls())
         scheduleDelayedAction(TextTrackChangesNotification);
 #endif
 }
         scheduleDelayedAction(TextTrackChangesNotification);
 #endif
 }