Title: [278925] trunk/Source/WebCore
Revision
278925
Author
commit-qu...@webkit.org
Date
2021-06-16 01:15:54 -0700 (Wed, 16 Jun 2021)

Log Message

[GStreamer] clang analysis: Unlocked access in ImageDecoderGStreamer.cpp
https://bugs.webkit.org/show_bug.cgi?id=226495

Patch by Philippe Normand <pnorm...@igalia.com> on 2021-06-16
Reviewed by Adrian Perez de Castro.

Remove unlocked access to the the m_messageDispatched instance variable. Also there is no
need to wait on the condition if the dispatching happens synchronously in the current
thread. No need to notify the condition either before dispatching, the only call to wait()
is after the asynchronous dispatch has been scheduled.

* platform/graphics/gstreamer/ImageDecoderGStreamer.cpp:
(WebCore::ImageDecoderGStreamer::InnerDecoder::preparePipeline):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (278924 => 278925)


--- trunk/Source/WebCore/ChangeLog	2021-06-16 08:11:18 UTC (rev 278924)
+++ trunk/Source/WebCore/ChangeLog	2021-06-16 08:15:54 UTC (rev 278925)
@@ -1,3 +1,18 @@
+2021-06-16  Philippe Normand  <pnorm...@igalia.com>
+
+        [GStreamer] clang analysis: Unlocked access in ImageDecoderGStreamer.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=226495
+
+        Reviewed by Adrian Perez de Castro.
+
+        Remove unlocked access to the the m_messageDispatched instance variable. Also there is no
+        need to wait on the condition if the dispatching happens synchronously in the current
+        thread. No need to notify the condition either before dispatching, the only call to wait()
+        is after the asynchronous dispatch has been scheduled.
+
+        * platform/graphics/gstreamer/ImageDecoderGStreamer.cpp:
+        (WebCore::ImageDecoderGStreamer::InnerDecoder::preparePipeline):
+
 2021-06-16  Martin Robinson  <mrobin...@webkit.org>
 
         Replace invalidSnapOffsetIndex with std::optional<unsigned>

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/ImageDecoderGStreamer.cpp (278924 => 278925)


--- trunk/Source/WebCore/platform/graphics/gstreamer/ImageDecoderGStreamer.cpp	2021-06-16 08:11:18 UTC (rev 278924)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/ImageDecoderGStreamer.cpp	2021-06-16 08:15:54 UTC (rev 278925)
@@ -373,7 +373,6 @@
         {
             Locker locker { decoder.m_messageLock };
             decoder.m_messageDispatched = false;
-            decoder.m_messageCondition.notifyOne();
         }
         if (&decoder.m_runLoop == &RunLoop::current())
             decoder.handleMessage(message);
@@ -384,11 +383,12 @@
                 if (weakThis)
                     weakThis->handleMessage(protectedMessage.get());
             });
+            {
+                Locker locker { decoder.m_messageLock };
+                if (!decoder.m_messageDispatched)
+                    decoder.m_messageCondition.wait(decoder.m_messageLock);
+            }
         }
-        if (!decoder.m_messageDispatched) {
-            Locker locker { decoder.m_messageLock };
-            decoder.m_messageCondition.wait(decoder.m_messageLock);
-        }
         gst_message_unref(message);
         return GST_BUS_DROP;
     }, this, nullptr);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to