This commit is contained in:
Kovid Goyal 2023-01-20 18:14:34 +05:30
parent 7ee339ab14
commit e8e95f888d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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();
});