Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 45f8701

Browse filesBrowse files
Thomas A Caswelltacaswell
authored andcommitted
Re-wired signal/slot connections so that the figure in removed from
Gcf when it is closed. In PR #1498 the attribute WA_DeleteOnClose was no longer set on the QtMainWindow object in QtFigureManager. The signal connection that was being used to remove the figure from Gcf when the window was closed was tied to the `destroyed()` signal of QtMainWindow, which is no longer being destroyed. Thus, gca and gcf would return references to no-longer visible figures/axes. _widgetclosed is now called when MainWindow emits 'closing()'.
1 parent 726e67e commit 45f8701
Copy full SHA for 45f8701

File tree

Expand file treeCollapse file tree

1 file changed

+4
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-3
lines changed

‎lib/matplotlib/backends/backend_qt4.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_qt4.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,9 @@ def __init__( self, canvas, num ):
389389
self.window = MainWindow()
390390
self.window.connect(self.window, QtCore.SIGNAL('closing()'),
391391
canvas.close_event)
392-
392+
self.window.connect( self.window, QtCore.SIGNAL( 'closing()' ),
393+
self._widgetclosed )
394+
393395
self.window.setWindowTitle("Figure %d" % num)
394396
image = os.path.join( matplotlib.rcParams['datapath'],'images','matplotlib.png' )
395397
self.window.setWindowIcon(QtGui.QIcon( image ))
@@ -403,8 +405,7 @@ def __init__( self, canvas, num ):
403405
self.canvas.setFocusPolicy( QtCore.Qt.StrongFocus )
404406
self.canvas.setFocus()
405407

406-
QtCore.QObject.connect( self.window, QtCore.SIGNAL( 'destroyed()' ),
407-
self._widgetclosed )
408+
408409
self.window._destroying = False
409410

410411
self.toolbar = self._get_toolbar(self.canvas, self.window)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.