enigma2: fixed random crashes (caused by missing del call)
[opendreambox.git] / meta-opendreambox / recipes-dreambox / enigma2 / enigma2-3.999git20130831 / 0001-added-missing-del-dict-entry-fixes-some-crashes-at-d.patch
1 From 4ab85cc0199a2adc9bfe76d135eff3da25bb48b3 Mon Sep 17 00:00:00 2001
2 From: ghost <andreas.monzner@dream-property.net>
3 Date: Sun, 1 Sep 2013 01:04:02 +0200
4 Subject: [PATCH] added missing del dict entry (fixes some crashes at different
5  places), add some comments to the code...
6
7 ---
8  lib/python/Screens/Screen.py | 12 ++++++++----
9  1 file changed, 8 insertions(+), 4 deletions(-)
10
11 diff --git a/usr/lib/enigma2/python/Screens/Screen.py b/usr/lib/enigma2/python/Screens/Screen.py
12 index e330e7b..1a338aa 100644
13 --- a/usr/lib/enigma2/python/Screens/Screen.py
14 +++ b/usr/lib/enigma2/python/Screens/Screen.py
15 @@ -124,13 +124,17 @@ class Screen(dict, GUISkin):
16                         val.disconnectAll()  # disconnected converter/sources and probably destroy them. Sources will not be destroyed.
17  
18                 del self.session
19 +
20 +               # we can have multiple dict entries with different names but same Element
21 +               # but we dont can call destroy multiple times
22                 for name in self.keys():
23                         val = self[name]
24 -                       if val:
25 +                       del self[name] # remove from dict
26 +                       if val: # is not a duplicate...
27                                 val.destroy()
28 -                       for (n, v) in self.items():
29 -                               if v == val:
30 -                                       self[n] = None
31 +                               for (n, v) in self.items():
32 +                                       if v == val: # check if it is the same Element
33 +                                               self[n] = None # mark as duplicate
34  
35                 self.renderer = [ ]
36  
37 -- 
38 1.8.4.rc3
39