[pitivi] AudioPreviewer: initialize pipeline to None, and check if it exists



commit 30eea02f8f2b059fa8dd7c18115d3b2eb8178069
Author: Mathieu Duponchelle <mduponchelle1 gmail com>
Date:   Thu Jan 23 19:23:03 2014 +0100

    AudioPreviewer: initialize pipeline to None, and check if it exists
    
    before trying to stop it.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=720879

 pitivi/timeline/previewers.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/timeline/previewers.py b/pitivi/timeline/previewers.py
index 1789c88..fb9479f 100644
--- a/pitivi/timeline/previewers.py
+++ b/pitivi/timeline/previewers.py
@@ -722,6 +722,7 @@ class AudioPreviewer(Clutter.Actor, PreviewGenerator, Zoomable, Loggable):
         Zoomable.__init__(self)
         Loggable.__init__(self)
         PreviewGenerator.__init__(self, GES.TrackType.AUDIO)
+        self.pipeline = None
         self.discovered = False
         self.bElement = bElement
         self._uri = quote_uri(bElement.props.uri)  # Guard against malformed URIs
@@ -960,8 +961,11 @@ class AudioPreviewer(Clutter.Actor, PreviewGenerator, Zoomable, Loggable):
         if self.adapter is not None:
             self.adapter.stop()
             self.adapter = None
-        self.pipeline.set_state(Gst.State.NULL)
-        self.pipeline.get_state(Gst.CLOCK_TIME_NONE)
+
+        if self.pipeline:
+            self.pipeline.set_state(Gst.State.NULL)
+            self.pipeline.get_state(Gst.CLOCK_TIME_NONE)
+
         PreviewGenerator.emit(self, "done")
 
     def cleanup(self):


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