audioresample: Make src query MT-safe
authorHavard Graff <havard.graff@tandberg.com>
Sun, 20 Mar 2011 07:59:33 +0000 (08:59 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 8 Apr 2011 13:04:41 +0000 (15:04 +0200)
It is possible that the element might be going down while the event arrives

gst/audioresample/gstaudioresample.c

index 92e38dd..8f9ea3b 100644 (file)
@@ -1264,8 +1264,12 @@ static gboolean
 gst_audio_resample_query (GstPad * pad, GstQuery * query)
 {
   GstAudioResample *resample = GST_AUDIO_RESAMPLE (gst_pad_get_parent (pad));
-  GstBaseTransform *trans = GST_BASE_TRANSFORM (resample);
+  GstBaseTransform *trans;
   gboolean res = TRUE;
+  if (G_UNLIKELY (resample == NULL))
+    return FALSE;
+
+  trans = GST_BASE_TRANSFORM (resample);
 
   switch (GST_QUERY_TYPE (query)) {
     case GST_QUERY_LATENCY: