[pitivi] clip: Disconnect from children on release



commit baf7dcde44c1971bb31ba63894653f7c9b3561f7
Author: Thibault Saunier <tsaunier gnome org>
Date:   Tue Dec 15 14:02:04 2015 +0000

    clip: Disconnect from children on release
    
    Differential Revision: https://phabricator.freedesktop.org/D589

 pitivi/timeline/elements.py |    6 ++++++
 pitivi/utils/misc.py        |   13 +++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 65c1570..9f731b1 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -821,6 +821,12 @@ class Clip(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
         for child in self.bClip.get_children(True):
             self.__disconnectFromChild(child)
 
+        misc.disconnectAllByFunc(self.bClip, self._startChangedCb)
+        misc.disconnectAllByFunc(self.bClip, self._durationChangedCb)
+        misc.disconnectAllByFunc(self.bClip, self._layerChangedCb)
+        misc.disconnectAllByFunc(self.bClip, self._childAddedCb)
+        misc.disconnectAllByFunc(self.bClip, self._childRemovedCb)
+
     def __showHandles(self):
         for handle in self.handles:
             handle.show()
diff --git a/pitivi/utils/misc.py b/pitivi/utils/misc.py
index b383413..235dc0e 100644
--- a/pitivi/utils/misc.py
+++ b/pitivi/utils/misc.py
@@ -38,6 +38,19 @@ from pitivi.utils.threads import Thread
 from pitivi.configure import APPMANUALURL_OFFLINE, APPMANUALURL_ONLINE, APPNAME
 
 
+# Work around https://bugzilla.gnome.org/show_bug.cgi?id=759249
+def disconnectAllByFunc(obj, func):
+    i = 0
+    while True:
+        i += 1
+        try:
+            obj.disconnect_by_func(func)
+        except TypeError:
+            return i
+
+    return i
+
+
 def format_ns(timestamp):
     if timestamp is None:
         return None


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