From e8e95f888d1b99022f4d12bcb1b96629f82ae6c8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 20 Jan 2023 18:14:34 +0530 Subject: [PATCH] ... --- src/calibre/utils/windows/winspeech.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/windows/winspeech.cpp b/src/calibre/utils/windows/winspeech.cpp index 1174fde0fe..732408f452 100644 --- a/src/calibre/utils/windows/winspeech.cpp +++ b/src/calibre/utils/windows/winspeech.cpp @@ -114,8 +114,11 @@ Synthesizer_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { INITIALIZE static void Synthesizer_dealloc(Synthesizer *self_) { synthesizer_weakrefs.unregister_ref(self_, [](Synthesizer *self) { - self->synth = SpeechSynthesizer{nullptr}; - self->player = MediaPlayer{nullptr}; + try { + self->~Synthesizer(); + } catch (...) { + fprintf(stderr, "Unhandled exception during Synthesizer object destruction, ignored.\n"); + } Py_TYPE(self)->tp_free((PyObject*)self); CoUninitialize(); });