[cheese] Avoid warnings on exit when playback hasn't started



commit 840e6106cfe9b2e5cbc7a7bb29989bbeab17ea26
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Nov 27 17:20:51 2009 +0000

    Avoid warnings on exit when playback hasn't started
    
    When exiting cheese before the GStreamer pipeline is ready,
    avoid warnings trying to unref non-existant GStreamer pipelines.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=603167

 src/cheese-webcam.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/cheese-webcam.c b/src/cheese-webcam.c
index 6bfdeb0..00046cd 100644
--- a/src/cheese-webcam.c
+++ b/src/cheese-webcam.c
@@ -1285,7 +1285,8 @@ cheese_webcam_stop (CheeseWebcam *webcam)
 {
   CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
 
-  gst_element_set_state (priv->pipeline, GST_STATE_NULL);
+  if (priv->pipeline != NULL)
+    gst_element_set_state (priv->pipeline, GST_STATE_NULL);
   priv->pipeline_is_playing = FALSE;
 }
 
@@ -1444,11 +1445,12 @@ cheese_webcam_finalize (GObject *object)
   CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
 
   cheese_webcam_stop (webcam);
-  gst_object_unref (priv->pipeline);
+  if (priv->pipeline != NULL)
+    gst_object_unref (priv->pipeline);
 
-  if (priv->is_recording)
+  if (priv->is_recording && priv->photo_save_bin != NULL)
     gst_object_unref (priv->photo_save_bin);
-  else
+  else if (priv->video_save_bin != NULL)
     gst_object_unref (priv->video_save_bin);
 
   g_free (priv->photo_filename);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]