Commit e407926
committed
use QMainWindow.closeEvent for close events
The current code uses the QWidget.destroyed signal
to emit a close event into matplotlib. This is a very
bad idea, as it is a heavy abuse of Qt functionality.
When a main window is closed in Qt, it and its children
are deleted if the DeleteOnClose flag is set (which we
did set). This causes the QWidget.destroyed signal to be
called. Setting the DeleteOnClose flag is a very bad
idea, since objects should only be deleted by the
garbage collector. Soon after, PyQt4 will complain
that "the underlying C++ object has been deleted", since
the object is alive for python but dead for C++.
This patch changes the machinery to use the
QMainWindow.closeEvent to emit a close_event, which is
what one actually wants.1 parent 32c302c commit e407926
1 file changed
Lines changed: 7 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | 211 | | |
224 | 212 | | |
225 | 213 | | |
| |||
377 | 365 | | |
378 | 366 | | |
379 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
380 | 372 | | |
381 | 373 | | |
382 | 374 | | |
| |||
391 | 383 | | |
392 | 384 | | |
393 | 385 | | |
394 | | - | |
395 | | - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
396 | 389 | | |
397 | 390 | | |
398 | 391 | | |
| |||
619 | 612 | | |
620 | 613 | | |
621 | 614 | | |
622 | | - | |
623 | 615 | | |
624 | 616 | | |
625 | 617 | | |
| |||
0 commit comments