[pitivi] undo: timeline: Never add TrackElement to a clip when not needed
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] undo: timeline: Never add TrackElement to a clip when not needed
- Date: Mon, 11 Mar 2019 15:09:43 +0000 (UTC)
commit 7abdfe2618220c89647bbfb749bb09b743897caf
Author: Thibault Saunier <tsaunier igalia com>
Date: Fri Mar 8 18:47:29 2019 -0300
undo: timeline: Never add TrackElement to a clip when not needed
Otherwise it might fail at doing so if adding it would lead to an
inconsistent timeline, with fully overlapped TrackElements for example.
pitivi/undo/timeline.py | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/undo/timeline.py b/pitivi/undo/timeline.py
index 4b79004c..01150167 100644
--- a/pitivi/undo/timeline.py
+++ b/pitivi/undo/timeline.py
@@ -286,13 +286,21 @@ class ClipAction(UndoableAction):
def add(self):
self.clip.set_name(None)
+ timeline = self.layer.get_timeline()
children = self.clip.get_children(False)
- self.layer.add_clip(self.clip)
- # GES adds children if the clip had none. Make sure they are removed.
- for child in self.clip.get_children(False):
- if child not in children:
- self.clip.remove(child)
- self.layer.get_timeline().get_asset().pipeline.commit_timeline()
+
+ def child_added_cb(clip, elem):
+ if elem not in children:
+ clip.remove(elem)
+ GObject.signal_stop_emission_by_name(clip, "child-added")
+
+ self.clip.connect("child-added", child_added_cb)
+ try:
+ res = self.layer.add_clip(self.clip)
+ assert(res)
+ finally:
+ self.clip.disconnect_by_func(child_added_cb)
+ timeline.get_asset().pipeline.commit_timeline()
def _child_added_cb(self, clip, track_element):
clip.remove(track_element)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]