From 4c7c279dd21f064f133fda71af2a9cf9a9739447 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 18 Apr 2014 10:55:01 -0400 Subject: [PATCH] Avoid crashes on quit under Windows --- qt/run_template.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/qt/run_template.py b/qt/run_template.py index 1c10b0ab..22070f9b 100644 --- a/qt/run_template.py +++ b/qt/run_template.py @@ -7,6 +7,7 @@ import sys import os.path as op +import gc from PyQt5.QtCore import QCoreApplication, QSettings from PyQt5.QtGui import QIcon, QPixmap @@ -39,7 +40,14 @@ def main(): app.setWindowIcon(QIcon(QPixmap(":/{0}".format(DupeGuru.LOGO_NAME)))) dgapp = DupeGuru() install_excepthook('https://github.com/hsoft/dupeguru/issues') - return app.exec() + result = app.exec() + # I was getting weird crashes when quitting under Windows, and manually deleting main app + # references with gc.collect() in between seems to fix the problem. + del dgapp + gc.collect() + del app + gc.collect() + return result if __name__ == "__main__": sys.exit(main())