Skip to content

Commit 4042514

Browse files
committed
fix qt close event bug
1 parent 9c676df commit 4042514

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/matplotlib/backends/backend_qt4.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,17 @@ def __init__( self, figure ):
138138
w,h = self.get_width_height()
139139
self.resize( w, h )
140140

141+
# JDH: Note the commented out code below does not work as
142+
# expected, because according to Pierre Raybaut, The reason is
143+
# that PyQt fails (silently) to call a method of this object
144+
# just before detroying it. Using a lambda function will work,
145+
# exactly the same as using a function (which is not bound to
146+
# the object to be destroyed).
147+
#
148+
#QtCore.QObject.connect(self, QtCore.SIGNAL('destroyed()'),
149+
# self.close_event)
141150
QtCore.QObject.connect(self, QtCore.SIGNAL('destroyed()'),
142-
self.close_event)
151+
lambda: self.close_event())
143152

144153
def __timerEvent(self, event):
145154
# hide until we can test and fix

0 commit comments

Comments
 (0)