diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2006-06-25 21:23:19 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2006-06-25 21:23:19 +0000 |
| commit | 687353c5fefbeea8486cbb28dedf52a53dc65e9b (patch) | |
| tree | 963996d607fce0f991540792c2790c806adc8401 | |
| parent | d5abd2f599da721cf673d6a9caee06eb4ed402c2 (diff) | |
| download | enigma2-687353c5fefbeea8486cbb28dedf52a53dc65e9b.tar.gz enigma2-687353c5fefbeea8486cbb28dedf52a53dc65e9b.zip | |
add disconnect to elements, and disconnect renderer from sources on screen close
| -rw-r--r-- | lib/python/Components/Element.py | 18 | ||||
| -rw-r--r-- | lib/python/Screens/Screen.py | 7 |
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/python/Components/Element.py b/lib/python/Components/Element.py index 6f812b20..fc709139 100644 --- a/lib/python/Components/Element.py +++ b/lib/python/Components/Element.py @@ -25,6 +25,24 @@ class Element: self.connectUpstream(upstream) upstream.connectDownstream(self) + # we disconnect from down to up + def disconnectAll(self): + # we should not disconnect from upstream if + # there are still elements depending on us. + assert len(self.downstream_elements) == 0, "there are still downstream elements left" + + # disconnect all upstream elements from us + for upstream in self.upstream_elements: + upstream.disconnectDownstream(self) + + def disconnectDownstream(self, downstream): + self.downstream_elements.remove(downstream) + if self.master == downstream: + self.master = None + + if len(self.downstream_elements) == 0: + self.disconnectAll() + # default action: push downstream def changed(self): self.downstream_elements.changed() diff --git a/lib/python/Screens/Screen.py b/lib/python/Screens/Screen.py index bbc6b1ec..5f1cf6d6 100644 --- a/lib/python/Screens/Screen.py +++ b/lib/python/Screens/Screen.py @@ -64,6 +64,13 @@ class Screen(dict, HTMLSkin, GUISkin): # fixup circular references del self.helpList GUISkin.close(self) + + # first disconnect all render from their sources. + # we might split this out into a "unskin"-call, + # but currently we destroy the screen afterwards + # anyway. + for val in self.renderer: + val.disconnectAll() # disconnected converter/sources and probably destroy them del self.session for (name, val) in self.items(): |
