Mercurial > libervia-desktop-kivy
changeset 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 | 520fd0f50233 |
files | cagou/core/cagou_main.py cagou/plugins/plugin_wid_widget_selector.py |
diffstat | 2 files changed, 8 insertions(+), 6 deletions(-) [+] |
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
--- a/cagou/plugins/plugin_wid_widget_selector.py Mon Mar 11 08:39:43 2019 +0100 +++ b/cagou/plugins/plugin_wid_widget_selector.py Mon Mar 11 20:24:04 2019 +0100 @@ -50,6 +50,7 @@ class WidgetSelector(cagou_widget.CagouWidget): + # TODO: should inherit from QuickWidget def __init__(self): super(WidgetSelector, self).__init__()