diff cagou/core/cagou_main.py @ 267:896f78760b63

core: fixed crash when calling deleteUnusedWidgetInstances on widgets not inheriting from QuickWidget
author Goffi <goffi@goffi.org>
date Mon, 11 Mar 2019 20:24:04 +0100
parents b3f97729e983
children c4990a7d5dbd
line wrap: on
line diff
--- a/cagou/core/cagou_main.py	Mon Mar 11 08:39:43 2019 +0100
+++ b/cagou/core/cagou_main.py	Mon Mar 11 20:24:04 2019 +0100
@@ -774,12 +774,13 @@
         """
         # FIXME: unused for now
         to_delete = []
-        for w in self.widgets.getWidgetInstances(widget):
-            if w.parent is None and w != widget:
-                to_delete.append(w)
-        for w in to_delete:
-            log.debug(u"cleaning widget: {wid}".format(wid=w))
-            self.widgets.deleteWidget(w)
+        if isinstance(widget, quick_widgets.QuickWidget):
+            for w in self.widgets.getWidgetInstances(widget):
+                if w.parent is None and w != widget:
+                    to_delete.append(w)
+            for w in to_delete:
+                log.debug(u"cleaning widget: {wid}".format(wid=w))
+                self.widgets.deleteWidget(w)
 
     def getOrClone(self, widget):
         """Get a QuickWidget if it has not parent set else clone it