From 0135abee89ccf5403235c869d8e14ecd424d7051 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Tue, 3 Jan 2012 10:01:20 +0200 Subject: [PATCH] compositor: avoid scheduling rendering on shutdown After the compositor exits the main loop in wl_display_run(), set the compositor state to SLEEPING. This prevents scheduling repaints, that will never be executed. A repaint is scheduled by calling wl_event_loop_add_idle(), which creates an idle event source. Normally the idle event source object is destroyed after it has been executed. However, in the shutdown case we never dispatch events again, and the object is leaked. This leak is triggered by shell.c destructor, which destroys the desktop-shell client. Destroying a client ends up calling wlsc_compositor_schedule_repaint() while destroying the client resources, especially surfaces. Signed-off-by: Pekka Paalanen --- compositor/compositor.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compositor/compositor.c b/compositor/compositor.c index 980098d4..8b3ba3c3 100644 --- a/compositor/compositor.c +++ b/compositor/compositor.c @@ -2174,6 +2174,9 @@ int main(int argc, char *argv[]) wl_display_run(display); + /* prevent further rendering while shutting down */ + ec->state = WLSC_COMPOSITOR_SLEEPING; + if (xserver) wlsc_xserver_destroy(ec);