From 6dcb51a3daf43fa776caeb674adc3c0962949fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 18 Mar 2012 21:08:00 +0100 Subject: [PATCH] Don't present parent window if it is already destroyed When creating a new record from the search dialog, the callback destroys the search dialog before the form dialog is destroyed. --- tryton/gui/window/nomodal.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tryton/gui/window/nomodal.py b/tryton/gui/window/nomodal.py index c100e2b596..95e5206602 100644 --- a/tryton/gui/window/nomodal.py +++ b/tryton/gui/window/nomodal.py @@ -1,5 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. +import gtk + from tryton.gui.main import Main import tryton.common as common @@ -22,6 +24,9 @@ class NoModal(object): def destroy(self): self.page.dialogs.remove(self) + # Test if the parent is not already destroyed + if self.parent not in gtk.window_list_toplevels(): + return self.parent.present() self.sensible_widget.props.sensitive = True if self.parent_focus: