From d916aae54f098daee33fa311f226bc87f8e3099e Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 9 Nov 2023 22:14:50 -0500 Subject: [PATCH] FIX: allow re-shown Qt windows to be re-destroyed When a Qt window is closed we do not strip off the Qt components and it is technically possible to re-show it. However, the latch we use to detect re-entrant destruction does not get reset so the figure can not be re-destroyed. --- lib/matplotlib/backends/backend_qt.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/matplotlib/backends/backend_qt.py b/lib/matplotlib/backends/backend_qt.py index cbc490ef6cd1..b79698f1d661 100644 --- a/lib/matplotlib/backends/backend_qt.py +++ b/lib/matplotlib/backends/backend_qt.py @@ -602,6 +602,7 @@ def start_main_loop(cls): qt_compat._exec(qapp) def show(self): + self.window._destroying = False self.window.show() if mpl.rcParams['figure.raise_window']: self.window.activateWindow()