Fix a subtle decref bug that caused a GC assertion to fail in a debug
build (assert(gc->gc.gc_refs != 0) in visit_decref()). Because OSSAudioError is a global, we must compensate (twice!) for PyModule_AddObject()'s "helpful" decref of the object it adds.
This commit is contained in:
parent
01e3273164
commit
f39dafb10a
|
@ -938,6 +938,9 @@ initossaudiodev(void)
|
||||||
|
|
||||||
OSSAudioError = PyErr_NewException("ossaudiodev.OSSAudioError", NULL, NULL);
|
OSSAudioError = PyErr_NewException("ossaudiodev.OSSAudioError", NULL, NULL);
|
||||||
if (OSSAudioError) {
|
if (OSSAudioError) {
|
||||||
|
/* Each call to PyModule_AddObject decrefs it; compensate: */
|
||||||
|
Py_INCREF(OSSAudioError);
|
||||||
|
Py_INCREF(OSSAudioError);
|
||||||
PyModule_AddObject(m, "error", OSSAudioError);
|
PyModule_AddObject(m, "error", OSSAudioError);
|
||||||
PyModule_AddObject(m, "OSSAudioError", OSSAudioError);
|
PyModule_AddObject(m, "OSSAudioError", OSSAudioError);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue