Real fix for T44127: Python does not guarantee to free all objects on exit...

All kudos to Campbell for the head-up and patch!
This commit is contained in:
Bastien Montagne 2015-04-01 09:34:01 +02:00
parent 6461fbd9ce
commit f7dbce9914
Notes: blender-bot 2023-02-14 09:20:14 +01:00
Referenced by issue #44127, Error: Not freed memory blocks
3 changed files with 15 additions and 0 deletions

View File

@ -821,3 +821,12 @@ PyObject *BPY_app_translations_struct(void)
return ret;
}
void BPY_app_translations_end(void)
{
/* Incase the object remains in a module's namespace, see T44127. */
#ifdef WITH_INTERNATIONAL
_clear_translations_cache();
#endif
}

View File

@ -28,5 +28,6 @@
#define __BPY_APP_TRANSLATIONS_H__
PyObject *BPY_app_translations_struct(void);
void BPY_app_translations_end(void);
#endif /* __BPY_APP_TRANSLATIONS_H__ */

View File

@ -61,6 +61,8 @@
#include "bpy_traceback.h"
#include "bpy_intern_string.h"
#include "bpy_app_translations.h"
#include "DNA_text_types.h"
#include "BKE_appdir.h"
@ -358,6 +360,9 @@ void BPY_python_end(void)
bpy_intern_string_exit();
/* bpy.app modules that need cleanup */
BPY_app_translations_end();
#ifndef WITH_PYTHON_MODULE
BPY_atexit_unregister(); /* without this we get recursive calls to WM_exit */