Fix last part of T38244: memory leak when scaling any panel

Issue is not noticeable with default font, but i18n one can use more than 500Mo of ram when cached in undreds of different sizes.

Campbell had already done most of the work in rBa780e7f3f09f and rB6b283f116829, just had to call BLF_cache_clear() in _exit funcs of VIEW2D_zoom & co operators.
This commit is contained in:
Bastien Montagne 2014-01-19 14:57:48 +01:00
parent 621bf47e91
commit d358f1f9e7
1 changed files with 10 additions and 1 deletions

View File

@ -38,6 +38,8 @@
#include "BLI_utildefines.h"
#include "BLI_math_base.h"
#include "BLF_api.h"
#include "BKE_context.h"
#include "RNA_access.h"
@ -46,7 +48,6 @@
#include "WM_api.h"
#include "WM_types.h"
#include "ED_screen.h"
#include "UI_view2d.h"
@ -663,6 +664,10 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
/* cleanup temp customdata */
static void view_zoomstep_exit(wmOperator *op)
{
/* Fonts are stored at each DPI level, without this we can easy load 100's of fonts.
* Not an issue with embedded font, but can use over 500Mo with i18n ones! See T38244. */
BLF_cache_clear();
if (op->customdata) {
MEM_freeN(op->customdata);
op->customdata = NULL;
@ -894,6 +899,10 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
/* cleanup temp customdata */
static void view_zoomdrag_exit(bContext *C, wmOperator *op)
{
/* Fonts are stored at each DPI level, without this we can easy load 100's of fonts.
* Not an issue with embedded font, but can use over 500Mo with i18n ones! See T38244. */
BLF_cache_clear();
if (op->customdata) {
v2dViewZoomData *vzd = op->customdata;