diff --git a/examples/drawtext/main.c b/examples/drawtext/main.c index 98d206f9..615340e7 100644 --- a/examples/drawtext/main.c +++ b/examples/drawtext/main.c @@ -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) diff --git a/ui_attrstr.h b/ui_attrstr.h index f4302cd5..3486b4e9 100644 --- a/ui_attrstr.h +++ b/ui_attrstr.h @@ -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); diff --git a/windows/fontbutton.cpp b/windows/fontbutton.cpp index 29de64b6..d6e5e0d8 100644 --- a/windows/fontbutton.cpp +++ b/windows/fontbutton.cpp @@ -121,3 +121,8 @@ uiFontButton *uiNewFontButton(void) return b; } + +void uiFreeFontButtonFont(uiFontDescriptor *desc) +{ + uiprivFree((char *) (desc->Family)); +}