Free graphics contexts when closing Yutani windows in Python

This commit is contained in:
Kevin Lange 2017-01-07 19:27:41 +09:00
parent 6e96830525
commit 8989ff149c
3 changed files with 8 additions and 0 deletions

View File

@ -867,3 +867,9 @@ void reinit_graphics_yutani(gfx_context_t * out, yutani_window_t * window) {
}
}
void release_graphics_yutani(gfx_context_t * gfx) {
if (gfx->backbuffer != gfx->buffer) {
free(gfx->backbuffer);
}
free(gfx);
}

View File

@ -468,5 +468,6 @@ extern void yutani_timer_request(yutani_t * yctx, uint32_t precision, uint32_t f
extern gfx_context_t * init_graphics_yutani(yutani_window_t * window);
extern gfx_context_t * init_graphics_yutani_double_buffer(yutani_window_t * window);
extern void reinit_graphics_yutani(gfx_context_t * out, yutani_window_t * window);
extern void release_graphics_yutani(gfx_context_t * gfx);
#endif /* _YUTANI_H */

View File

@ -364,6 +364,7 @@ class Window(object):
def close(self):
"""Close the window."""
yutani_lib.yutani_close(yutani_ctx._ptr, self._ptr)
yutani_lib.release_graphics_yutani(self._gfx)
def move(self, x, y):
"""Move the window to the requested location."""