[pitivi] ui/preview: Avoid calculations using element if it's not valid anymore.



commit ab4e61645ba834820cfae678c0e8fb3ced7ffccb
Author: Edward Hervey <bilboed bilboed com>
Date:   Tue Apr 21 15:28:55 2009 +0200

    ui/preview: Avoid calculations using element if it's not valid anymore.
    
    This happens because goocanvas does calls after we release the related
    TrackObject.
---
 pitivi/ui/preview.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/pitivi/ui/preview.py b/pitivi/ui/preview.py
index 5efe39e..2364fca 100644
--- a/pitivi/ui/preview.py
+++ b/pitivi/ui/preview.py
@@ -86,12 +86,14 @@ class Preview(goocanvas.ItemSimple, goocanvas.Item, Zoomable):
 
     def do_simple_update(self, cr):
         cr.identity_matrix()
-        self.bounds = goocanvas.Bounds(0, 0,
+        if self.element.factory:
+            self.bounds = goocanvas.Bounds(0, 0,
             Zoomable.nsToPixel(self.element.duration), self.height)
 
     def do_simple_paint(self, cr, bounds):
         cr.identity_matrix()
-        self.previewer.render_cairo(cr, intersect(self.bounds, bounds),
+        if self.element.factory:
+            self.previewer.render_cairo(cr, intersect(self.bounds, bounds),
             self.element, self.bounds.y1)
 
     def do_simple_is_item_at(self, x, y, cr, pointer_event):



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