Unreviewed follow-up fix for r174460. Do not register for KVOs if the object does...
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Oct 2014 20:26:41 +0000 (20:26 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Oct 2014 20:26:41 +0000 (20:26 +0000)
* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
(-[CDMSessionMediaSourceAVFObjCObserver beginObserving:]):
(-[CDMSessionMediaSourceAVFObjCObserver stopObserving:]):
(-[CDMSessionMediaSourceAVFObjCObserver invalidate]):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm

index 1b246a063cb6a7b1201d9ad5486d727b5b67205b..fd0ca851f1e6afa6a59d21e415b913bb5e2e756f 100644 (file)
@@ -1,3 +1,12 @@
+2014-10-08  Jer Noble  <jer.noble@apple.com>
+
+        Unreviewed follow-up fix for r174460. Do not register for KVOs if the object does not respond to the requested property.
+
+        * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
+        (-[CDMSessionMediaSourceAVFObjCObserver beginObserving:]):
+        (-[CDMSessionMediaSourceAVFObjCObserver stopObserving:]):
+        (-[CDMSessionMediaSourceAVFObjCObserver invalidate]):
+
 2014-10-08  Dean Jackson  <dino@apple.com>
 
         Add deprecation warning for CSSKeyframesRule::appendRule
index e68b27223b21a90e82d68e9498981cadfec2a502..a3e3988222054bcdf3986a5d1604e932b6f3ffcc 100644 (file)
@@ -87,21 +87,25 @@ SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVStreamSession);
 {
     ASSERT(!m_parsers.contains(parser));
     m_parsers.add(parser);
-    [parser addObserver:self forKeyPath:@"sessionIdentifier" options:(NSKeyValueObservingOptionNew|NSKeyValueObservingOptionInitial) context:nullptr];
+    if ([parser respondsToSelector:@selector(sessionIdentifier)])
+        [parser addObserver:self forKeyPath:@"sessionIdentifier" options:(NSKeyValueObservingOptionNew|NSKeyValueObservingOptionInitial) context:nullptr];
 }
 
 - (void)stopObserving:(AVStreamDataParser *)parser
 {
     ASSERT(m_parsers.contains(parser));
     m_parsers.remove(parser);
-    [parser removeObserver:self forKeyPath:@"sessionIdentifier" context:nullptr];
+    if ([parser respondsToSelector:@selector(sessionIdentifier)])
+        [parser removeObserver:self forKeyPath:@"sessionIdentifier" context:nullptr];
 }
 
 - (void)invalidate
 {
     m_parent = nullptr;
-    for (auto& parser : m_parsers)
-        [parser removeObserver:self forKeyPath:@"sessionIdentifier" context:nullptr];
+    for (auto& parser : m_parsers) {
+        if ([parser respondsToSelector:@selector(sessionIdentifier)])
+            [parser removeObserver:self forKeyPath:@"sessionIdentifier" context:nullptr];
+    }
     m_parsers.clear();
 }