Try to fix exceptions on ManagedWindow close

Issues #10252, #10642, #10821, #11163, #11440, #11476, #11482, #11508
This commit is contained in:
prculley 2020-01-08 10:26:04 -06:00 committed by Paul Culley
parent 823bcaac0d
commit d83fff3b62

View File

@ -32,6 +32,14 @@ the create/deletion of dialog windows.
import os import os
from io import StringIO from io import StringIO
import html import html
import logging
#-------------------------------------------------------------------------
#
# Set up logging
#
#-------------------------------------------------------------------------
_LOG = logging.getLogger(".")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GNOME/GTK # GNOME/GTK
@ -575,6 +583,9 @@ class ManagedWindow:
Takes care of closing children and removing itself from menu. Takes care of closing children and removing itself from menu.
""" """
if hasattr(self, 'opened') and not self.opened:
_LOG.warning("Tried to close a ManagedWindow more than once.")
return # in case close somehow gets called again
self.opened = False self.opened = False
self._save_position(save_config=False) # the next line will save it self._save_position(save_config=False) # the next line will save it
self._save_size() self._save_size()