From 8832aaa6a89d0e7a55848b387f9656216becffdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 11 Jul 2016 18:35:42 +0200 Subject: [PATCH] Don't set cursor if treeview has no more a model This can happen because set_cursor is often called using idle_add so the treeview could have been destroyed in the meantime. issue5069 review27491002 --- tryton/gui/window/view_form/view/list.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/view_form/view/list.py b/tryton/gui/window/view_form/view/list.py index 75f39862d2..2a4fb84eb3 100644 --- a/tryton/gui/window/view_form/view/list.py +++ b/tryton/gui/window/view_form/view/list.py @@ -1151,8 +1151,8 @@ class ViewTree(View): def set_cursor(self, new=False, reset_view=True): self.treeview.grab_focus() - if self.screen.current_record: - model = self.treeview.get_model() + model = self.treeview.get_model() + if self.screen.current_record and model: path = model.on_get_path(self.screen.current_record) if model.get_flags() & gtk.TREE_MODEL_LIST_ONLY: path = (path[0],)