[pitivi/1.0] effects: Remove properties values cache



commit 595b8313c45ed3be473bb06071f7d62d511d37f4
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Thu Nov 22 04:37:28 2018 +0100

    effects: Remove properties values cache
    
    Fixes the backtraces seen in #2259.
    
    In case of the aspectratiocrop effect, changing the aspect ratio value
    leads to other props being automatically changed. The UI was
    automatically updated and then the widget change triggered the same
    mechanism used when the user changes a property. This consists of a new
    toplevel undoable operation being created, when one was already being
    recorded.
    
    There was already a mechanism to prevent this, starting the toplevel
    operation only if the value from the widget and the current property
    value actually differ, but it was broken:
    - It was using a cache which was not kept up to date
    - The cache was holding (bool, value) instead of just value
    
    I removed the cache as we don't see any usefulness for it.

 pitivi/effects.py | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/pitivi/effects.py b/pitivi/effects.py
index 4f1d610a..de5bb271 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -607,7 +607,6 @@ class EffectsPropertiesManager:
 
     def __init__(self, app):
         self.cache_dict = {}
-        self._current_element_values = {}
         self.app = app
 
     def getEffectConfigurationUI(self, effect):
@@ -628,10 +627,6 @@ class EffectsPropertiesManager:
             self._connectAllWidgetCallbacks(effect_widget, effect)
             self._postConfiguration(effect, effect_widget)
 
-        for prop in effect.list_children_properties():
-            value = effect.get_child_property(prop.name)
-            self._current_element_values[prop.name] = value
-
         return self.cache_dict[effect]
 
     def cleanCache(self, effect):
@@ -658,7 +653,9 @@ class EffectsPropertiesManager:
         if isinstance(value, Gst.Fraction):
             value = Gst.Fraction(int(value.num), int(value.denom))
 
-        if value != self._current_element_values.get(prop.name):
+        res, current_value = effect.get_child_property(prop.name)
+        assert res
+        if value != current_value:
             from pitivi.undo.timeline import CommitTimelineFinalizingAction
 
             pipeline = self.app.project_manager.current_project.pipeline
@@ -666,4 +663,3 @@ class EffectsPropertiesManager:
                                              finalizing_action=CommitTimelineFinalizingAction(pipeline),
                                              toplevel=True):
                 effect.set_child_property(prop.name, value)
-            self._current_element_values[prop.name] = value


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