summaryrefslogtreecommitdiff
path: root/desktop-shell
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>2014-04-29 17:54:02 +0300
committerKristian Høgsberg <krh@bitplanet.net>2014-04-29 13:33:26 -0700
commit15f9a26bb199c3567098b1b29815cae609010957 (patch)
tree770ef79756d4073cf743e06e9cc87ecdac217547 /desktop-shell
parent66cd2c1ce19b396d42a32287d512ade42a2ba758 (diff)
downloadweston-15f9a26bb199c3567098b1b29815cae609010957.tar.gz
shell: Fix memory leaks caused by the window close animation
In order to do the window close animation, a reference for a destroyed surface is kept. However, the reference count was also increased for unmapped surfaces, in which case the animation wouldn't run. Since the reference count was decremented in the animation done function, it would never be decreased for unmapped surfaces, causing them to not be released. The close animation also changed how shell surfaces are released. The destroy function for its resource was changed to not deallocate the surface, and instead keep it around until the animation finishes and the weston surface is destroyed. The destruction should happen in the destroy listener for the weston surface, but it wouldn't destroy the shell surface in the case the resource was still valid, assuming that it would be freed in the resource destroy function.
Diffstat (limited to 'desktop-shell')
-rw-r--r--desktop-shell/shell.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index bc4a2585..6fc797b0 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -3081,8 +3081,8 @@ shell_handle_surface_destroy(struct wl_listener *listener, void *data)
if (shsurf->resource)
wl_resource_destroy(shsurf->resource);
- else
- destroy_shell_surface(shsurf);
+
+ destroy_shell_surface(shsurf);
}
static void
@@ -3100,15 +3100,17 @@ handle_resource_destroy(struct wl_listener *listener, void *data)
container_of(listener, struct shell_surface,
resource_destroy_listener);
+ if (!weston_surface_is_mapped(shsurf->surface))
+ return;
+
shsurf->surface->ref_count++;
pixman_region32_fini(&shsurf->surface->pending.input);
pixman_region32_init(&shsurf->surface->pending.input);
pixman_region32_fini(&shsurf->surface->input);
pixman_region32_init(&shsurf->surface->input);
- if (weston_surface_is_mapped(shsurf->surface))
- weston_fade_run(shsurf->view, 1.0, 0.0, 300.0,
- fade_out_done, shsurf);
+ weston_fade_run(shsurf->view, 1.0, 0.0, 300.0,
+ fade_out_done, shsurf);
}
static void