Title: [217712] trunk/Source/WebCore
Revision
217712
Author
[email protected]
Date
2017-06-02 09:08:53 -0700 (Fri, 02 Jun 2017)

Log Message

Crash under OrientationNotifier::Observer::setNotifier()
https://bugs.webkit.org/show_bug.cgi?id=172847
<rdar://problem/32519127>

Reviewed by Youenn Fablet.

Update OrientationNotifier::Observer::setNotifier() to unregister itself from
its current notifier if it already has one. This is needed because
Internals::setCameraMediaStreamTrackOrientation() may be used to override the
notifier of an observer. If we override the notifier without unregistering
the observer from its previous notifier, then the previous notifier will not
get notified when the observer gets destroyed.

No new tests, already covered by webrtc/video-rotation.html that is currently
failing on some bots.

* platform/OrientationNotifer.h:
(WebCore::OrientationNotifier::Observer::setNotifier):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (217711 => 217712)


--- trunk/Source/WebCore/ChangeLog	2017-06-02 15:59:22 UTC (rev 217711)
+++ trunk/Source/WebCore/ChangeLog	2017-06-02 16:08:53 UTC (rev 217712)
@@ -1,3 +1,24 @@
+2017-06-02  Chris Dumez  <[email protected]>
+
+        Crash under OrientationNotifier::Observer::setNotifier()
+        https://bugs.webkit.org/show_bug.cgi?id=172847
+        <rdar://problem/32519127>
+
+        Reviewed by Youenn Fablet.
+
+        Update OrientationNotifier::Observer::setNotifier() to unregister itself from
+        its current notifier if it already has one. This is needed because
+        Internals::setCameraMediaStreamTrackOrientation() may be used to override the
+        notifier of an observer. If we override the notifier without unregistering
+        the observer from its previous notifier, then the previous notifier will not
+        get notified when the observer gets destroyed.
+
+        No new tests, already covered by webrtc/video-rotation.html that is currently
+        failing on some bots.
+
+        * platform/OrientationNotifer.h:
+        (WebCore::OrientationNotifier::Observer::setNotifier):
+
 2017-06-02  Javier Fernandez  <[email protected]>
 
         [css-grid] Logical margin incorrectly applied during the tracks sizing algorithm of auto tracks

Modified: trunk/Source/WebCore/platform/OrientationNotifer.h (217711 => 217712)


--- trunk/Source/WebCore/platform/OrientationNotifer.h	2017-06-02 15:59:22 UTC (rev 217711)
+++ trunk/Source/WebCore/platform/OrientationNotifer.h	2017-06-02 16:08:53 UTC (rev 217712)
@@ -38,7 +38,7 @@
     public:
         virtual ~Observer();
         virtual void orientationChanged(int orientation) = 0;
-        void setNotifier(OrientationNotifier* notifier) { m_notifier = notifier; }
+        void setNotifier(OrientationNotifier*);
 
     private:
         OrientationNotifier* m_notifier { nullptr };
@@ -65,6 +65,18 @@
         m_notifier->removeObserver(*this);
 }
 
+void OrientationNotifier::Observer::setNotifier(OrientationNotifier* notifier)
+{
+    if (m_notifier == notifier)
+        return;
+
+    if (m_notifier && notifier)
+        m_notifier->removeObserver(*this);
+
+    ASSERT(!m_notifier || !notifier);
+    m_notifier = notifier;
+}
+
 inline void OrientationNotifier::orientationChanged(int orientation)
 {
     m_orientation = orientation;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to