Added a uiFreeFontButtonFont() function to free resources allocated by uiFontButtonFont(), implemented it on Windows, and integrated it into the drawtext example. I'm going to continue chipping away at the Windows code for a bit longer, so I'll add this to the other platforms later.

This commit is contained in:
Pietro Gagliardi 2018-03-17 23:07:40 -04:00
parent 78e0684435
commit 8709838a8f
3 changed files with 7 additions and 0 deletions

View File

@ -106,6 +106,7 @@ static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *p)
// TODO clip to margins
uiDrawText(p->Context, textLayout, margins, margins);
uiDrawFreeTextLayout(textLayout);
uiFreeFontButtonFont(&defaultFont);
}
static void handlerMouseEvent(uiAreaHandler *a, uiArea *area, uiAreaMouseEvent *e)

View File

@ -495,3 +495,4 @@ _UI_EXTERN void uiFontButtonFont(uiFontButton *b, uiFontDescriptor *desc);
// TOOD SetFont, mechanics
_UI_EXTERN void uiFontButtonOnChanged(uiFontButton *b, void (*f)(uiFontButton *, void *), void *data);
_UI_EXTERN uiFontButton *uiNewFontButton(void);
_UI_EXTERN void uiFreeFontButtonFont(uiFontDescriptor *desc);

View File

@ -121,3 +121,8 @@ uiFontButton *uiNewFontButton(void)
return b;
}
void uiFreeFontButtonFont(uiFontDescriptor *desc)
{
uiprivFree((char *) (desc->Family));
}