compositor: Don't crash in prepare_frame() if the pad was just removed
authorSebastian Dröge <sebastian@centricular.com>
Tue, 1 Dec 2020 11:13:40 +0000 (13:13 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 1 Dec 2020 11:13:58 +0000 (13:13 +0200)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/950>

gst/compositor/compositor.c

index d3e1daa..12e24d1 100644 (file)
@@ -433,7 +433,10 @@ gst_compositor_pad_prepare_frame (GstVideoAggregatorPad * pad,
   /* Check if this frame is obscured by a higher-zorder frame
    * TODO: Also skip a frame if it's obscured by a combination of
    * higher-zorder frames */
-  l = g_list_find (GST_ELEMENT (vagg)->sinkpads, pad)->next;
+  l = g_list_find (GST_ELEMENT (vagg)->sinkpads, pad);
+  /* The pad might've just been removed */
+  if (l)
+    l = l->next;
   for (; l; l = l->next) {
     if (_pad_obscures_rectangle (vagg, l->data, frame_rect)) {
       frame_obscured = TRUE;