From 21698256a1b6466cd92f7d222ed8c08b51bb481e Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 4 Nov 2016 00:52:28 +0000 Subject: content: fix segfault when sink emits a NULL frame This happens when shutting down a pipeline. This was also supposed to be handled, just go it wrong. https://bugzilla.gnome.org/show_bug.cgi?id=773810 --- clutter-gst/clutter-gst-content.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/clutter-gst/clutter-gst-content.c b/clutter-gst/clutter-gst-content.c index 02b1bb6..20db2c7 100644 --- a/clutter-gst/clutter-gst-content.c +++ b/clutter-gst/clutter-gst-content.c @@ -36,6 +36,8 @@ #include "config.h" #endif +#include + #include "clutter-gst-content.h" #include "clutter-gst-private.h" #include "clutter-gst-marshal.h" @@ -146,24 +148,19 @@ update_frame (ClutterGstContent *self, { ClutterGstContentPrivate *priv = self->priv; ClutterGstFrame *old_frame; + ClutterGstVideoResolution old_res = { 0, }, new_res = { 0, }; old_frame = priv->current_frame; priv->current_frame = g_boxed_copy (CLUTTER_GST_TYPE_FRAME, new_frame); if (old_frame) - { - new_frame->resolution.par_n = old_frame->resolution.par_n; - new_frame->resolution.par_d = old_frame->resolution.par_d; - } + old_res = old_frame->resolution; + if (new_frame) + new_res = new_frame->resolution; - if (!old_frame || - (new_frame->resolution.width != old_frame->resolution.width || - new_frame->resolution.height != old_frame->resolution.height)) - { - g_signal_emit (self, signals[SIZE_CHANGE], 0, - new_frame->resolution.width, - new_frame->resolution.height); - } + if (memcmp(&old_res, &new_res, sizeof(old_res)) != 0) + g_signal_emit (self, signals[SIZE_CHANGE], 0, + new_res.width, new_res.height); if (old_frame) g_boxed_free (CLUTTER_GST_TYPE_FRAME, old_frame); -- cgit v1.2.1