compositor: Use a virtual destructor when shutting down

Backend can now rely on their destroy function getting called on shutdown,
so reset tty etc there instead of handling SIGTERM twice.
This commit is contained in:
Kristian Høgsberg 2010-12-01 16:52:15 -05:00
parent 50dc6989b8
commit caa6442556
5 changed files with 31 additions and 16 deletions

View file

@ -507,6 +507,12 @@ wayland_compositor_handle_event(int fd, uint32_t mask, void *data)
wl_display_iterate(c->parent.display, WL_DISPLAY_WRITABLE);
}
static void
wayland_destroy(struct wlsc_compositor *ec)
{
free(ec);
}
struct wlsc_compositor *
wayland_compositor_create(struct wl_display *display, int width, int height)
{
@ -556,6 +562,7 @@ wayland_compositor_create(struct wl_display *display, int width, int height)
if (c->parent.wl_source == NULL)
return NULL;
c->base.destroy = wayland_destroy;
c->base.authenticate = wayland_authenticate;
c->base.present = wayland_compositor_present;