From f5c8bdd4b3fb089370f3cc41a742b3385289efe1 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 8 Apr 2015 00:51:50 -0400 Subject: Finished Windows cleanup management. Everything (almost, only parentWindow is still around, but that shouldn't be a uiWindow to begin with) now cleaned! --- new/button_windows.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'new/button_windows.c') diff --git a/new/button_windows.c b/new/button_windows.c index 39fb8e0..0c9dafd 100644 --- a/new/button_windows.c +++ b/new/button_windows.c @@ -23,6 +23,13 @@ static BOOL onWM_NOTIFY(uiControl *c, WPARAM wParam, LPARAM lParam, void *data, return FALSE; } +static void onWM_DESTROY(uiControl *c, void *data) +{ + struct button *b = (struct button *) data; + + uiFree(b); +} + // from http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing #define buttonHeight 14 @@ -70,7 +77,8 @@ uiControl *uiNewButton(const char *text) p.hInstance = hInstance; p.onWM_COMMAND = onWM_COMMAND; p.onWM_NOTIFY = onWM_NOTIFY; - p.onCommandNotifyData = b; + p.onWM_DESTROY = onWM_DESTROY; + p.onCommandNotifyDestroyData = b; p.preferredSize = preferredSize; p.data = b; b->c = uiWindowsNewControl(&p); -- cgit v1.2.3