From 1d4e341583c0014f4cef6f50387f12672aba206c Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 9 Oct 2015 12:41:01 -0400 Subject: [PATCH] Fixed a memory leak in the Windows uiArea. --- windows/area.c | 2 ++ windows/draw.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/windows/area.c b/windows/area.c index 88901490..478fec57 100644 --- a/windows/area.c +++ b/windows/area.c @@ -56,6 +56,8 @@ static HRESULT doPaint(uiArea *a, ID2D1RenderTarget *rt, RECT *client, RECT *cli (*(ah->Draw))(ah, a, &dp); + freeContext(dp.Context); + return ID2D1RenderTarget_EndDraw(rt, NULL, NULL); } diff --git a/windows/draw.c b/windows/draw.c index 2ad16589..7862e2a2 100644 --- a/windows/draw.c +++ b/windows/draw.c @@ -262,6 +262,11 @@ uiDrawContext *newContext(ID2D1RenderTarget *rt) return c; } +void freeContext(uiDrawContext *c) +{ + uiFree(c); +} + static ID2D1Brush *makeSolidBrush(uiDrawBrush *b, ID2D1RenderTarget *rt, D2D1_BRUSH_PROPERTIES *props) { D2D1_COLOR_F color;