From d1032d86a76f27c7a6ed3dc08524e31e57a6bdf3 Mon Sep 17 00:00:00 2001 From: Ross Brown Date: Mon, 9 Dec 2024 04:39:45 +0000 Subject: [PATCH] Make sure Anki resets the QtMessageHandler as it is exiting (#3620) --- CONTRIBUTORS | 1 + qt/aqt/__init__.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a24b61799..84089f868 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -199,6 +199,7 @@ Park Hyunwoo Tomas Fabrizio Orsi Sawan Sunar hideo aoyama +Ross Brown ******************** diff --git a/qt/aqt/__init__.py b/qt/aqt/__init__.py index 2c39253c3..eca04b261 100644 --- a/qt/aqt/__init__.py +++ b/qt/aqt/__init__.py @@ -3,6 +3,7 @@ from __future__ import annotations +import atexit import logging import sys from collections.abc import Callable @@ -525,6 +526,7 @@ def setupGL(pm: aqt.profiles.ProfileManager) -> None: print(f"Qt {category}: {msg} {context}") qInstallMessageHandler(msgHandler) + atexit.register(qInstallMessageHandler, None) if driver == VideoDriver.OpenGL: # Leaving QT_OPENGL unset appears to sometimes produce different results