window: menu leak fixes
When a menu self-destructs, free also the widget and struct menu.
As menus are self-destructing, it does not make sense to store the
window pointer, since we cannot clear it automatically. Therefore,
rename window_create_menu() to window_show_menu() that does not return
the window pointer. It also calls window_schedule_redraw() internally.
Fixes Valgrind reported memory leaks.
The alternative would be to explicitly destroy the menu in application's
menu callback.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
diff --git a/clients/resizor.c b/clients/resizor.c
index 5eeb8ea..15900fc 100644
--- a/clients/resizor.c
+++ b/clients/resizor.c
@@ -171,12 +171,8 @@
};
input_get_position(input, &x, &y);
- resizor->menu = window_create_menu(resizor->display,
- input, time, resizor->window,
- x - 10, y - 10,
- menu_func, entries, 4);
-
- window_schedule_redraw(resizor->menu);
+ window_show_menu(resizor->display, input, time, resizor->window,
+ x - 10, y - 10, menu_func, entries, 4);
}
static void