From 18536764b48370db3f575d3f98e733af714bc280 Mon Sep 17 00:00:00 2001 From: Ander Conselvan de Oliveira Date: Fri, 20 Dec 2013 21:07:00 +0200 Subject: compositor: Destroy renderer in weston_compositor_shutdown() Currently we destroy the renderer before the outputs are destroyed, but that sometimes leads to an error since a reference to the renderer is necessary in order to destroy a gl_renderer_output. Since destroying the renderer is common among all backends, just move that call into weston_compositor_shutdown() immediately after the outputs being destroyed. --- src/compositor-drm.c | 2 -- src/compositor-fbdev.c | 2 -- src/compositor-headless.c | 2 -- src/compositor-rdp.c | 1 - src/compositor-rpi.c | 2 -- src/compositor-wayland.c | 2 -- src/compositor-x11.c | 2 -- src/compositor.c | 3 +++ 8 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/compositor-drm.c b/src/compositor-drm.c index f85298a3..d637e75f 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -2336,8 +2336,6 @@ drm_destroy(struct weston_compositor *ec) destroy_sprites(d); - ec->renderer->destroy(ec); - weston_compositor_shutdown(ec); if (d->gbm) diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c index e649d433..0d962693 100644 --- a/src/compositor-fbdev.c +++ b/src/compositor-fbdev.c @@ -797,8 +797,6 @@ fbdev_compositor_destroy(struct weston_compositor *base) udev_input_destroy(&compositor->input); - compositor->base.renderer->destroy(&compositor->base); - /* Destroy the output. */ weston_compositor_shutdown(&compositor->base); diff --git a/src/compositor-headless.c b/src/compositor-headless.c index 54974550..5a5c1e68 100644 --- a/src/compositor-headless.c +++ b/src/compositor-headless.c @@ -141,8 +141,6 @@ headless_destroy(struct weston_compositor *ec) { struct headless_compositor *c = (struct headless_compositor *) ec; - ec->renderer->destroy(ec); - weston_seat_release(&c->fake_seat); weston_compositor_shutdown(ec); diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c index 58342b9a..942af50e 100644 --- a/src/compositor-rdp.c +++ b/src/compositor-rdp.c @@ -521,7 +521,6 @@ rdp_restore(struct weston_compositor *ec) static void rdp_destroy(struct weston_compositor *ec) { - ec->renderer->destroy(ec); weston_compositor_shutdown(ec); free(ec); diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c index 1d52a94a..399090dd 100644 --- a/src/compositor-rpi.c +++ b/src/compositor-rpi.c @@ -422,8 +422,6 @@ rpi_compositor_destroy(struct weston_compositor *base) udev_input_destroy(&compositor->input); - compositor->base.renderer->destroy(&compositor->base); - /* destroys outputs, too */ weston_compositor_shutdown(&compositor->base); diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index 14ff4af3..d2d89427 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -1398,8 +1398,6 @@ wayland_destroy(struct weston_compositor *ec) { struct wayland_compositor *c = (struct wayland_compositor *) ec; - ec->renderer->destroy(ec); - weston_compositor_shutdown(ec); if (c->parent.shm) diff --git a/src/compositor-x11.c b/src/compositor-x11.c index 1b178b8a..6b5eb648 100644 --- a/src/compositor-x11.c +++ b/src/compositor-x11.c @@ -1419,8 +1419,6 @@ x11_destroy(struct weston_compositor *ec) wl_event_source_remove(compositor->xcb_source); x11_input_destroy(compositor); - ec->renderer->destroy(ec); - weston_compositor_shutdown(ec); /* destroys outputs, too */ XCloseDisplay(compositor->dpy); diff --git a/src/compositor.c b/src/compositor.c index ff0f3ab5..329ee494 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -3734,6 +3734,9 @@ weston_compositor_shutdown(struct weston_compositor *ec) wl_list_for_each_safe(output, next, &ec->output_list, link) output->destroy(output); + if (ec->renderer) + ec->renderer->destroy(ec); + weston_binding_list_destroy_all(&ec->key_binding_list); weston_binding_list_destroy_all(&ec->button_binding_list); weston_binding_list_destroy_all(&ec->touch_binding_list); -- cgit v1.2.3