fix recursive close crashes
[enigma2.git] / lib / python / Screens / ChannelSelection.py
index 7db3a1c..0e3ee2f 100644 (file)
@@ -43,9 +43,11 @@ class BouquetSelector(Screen):
                self.close(False)
 
 class ChannelContextMenu(Screen):
+       
        def __init__(self, session, csel):
                Screen.__init__(self, session)
                self.csel = csel
+               self.bsel = None
 
                self["actions"] = ActionMap(["OkCancelActions"],
                        {
@@ -117,13 +119,14 @@ class ChannelContextMenu(Screen):
                else:
                        cnt = len(bouquets)
                if cnt > 1: # show bouquet list
-                       self.session.openWithCallback(self.bouquetSelClosed, BouquetSelector, bouquets, self.addCurrentServiceToBouquet)
+                       self.bsel = self.session.openWithCallback(self.bouquetSelClosed, BouquetSelector, bouquets, self.addCurrentServiceToBouquet)
                elif cnt == 1: # add to only one existing bouquet
                        self.addCurrentServiceToBouquet(bouquets[0][1])
                else: #no bouquets in root.. so assume only one favourite list is used
                        self.addCurrentServiceToBouquet(self.csel.bouquet_root)
 
        def bouquetSelClosed(self, recursive):
+               self.bsel = None
                if recursive:
                        self.close(False)
 
@@ -137,7 +140,10 @@ class ChannelContextMenu(Screen):
 
        def addCurrentServiceToBouquet(self, dest):
                self.csel.addCurrentServiceToBouquet(dest)
-               self.close(True) # close bouquet selection
+               if self.bsel is not None:
+                       self.bsel.close(True)
+               else:
+                       self.close(True) # close bouquet selection
 
        def removeCurrentService(self):
                self.csel.removeCurrentService()