summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2012-05-31 13:04:01 +0300
committerAlon Levy <alevy@redhat.com>2012-06-15 10:34:57 +0300
commit8df3eba368e80f60ce815300b85a567a9b02141c (patch)
tree821e7dc52ce844f3b8e58ba031d48077dea4c913
parent22157d4750f9090927d2e3473aa3d3a4f5232792 (diff)
qxl_surface: don't unlink surface 0
The primary surface, i.e. qxl->primary, the only surface with id==0, is allocated in qxl_surface_cache_create_primary with prev==next==NULL. Unlinking it was producing a wrong cache->free_surfaces == NULL. This was not a problem because unlinking the primary only happened in switch_host, which then called surface_cache_init. In a following commit switch_host is simplified to destroy-primary+create-primary, so this bug needs to be fixed first to avoid leaking surfaces and reaching a no surface available situation.
-rw-r--r--src/qxl_surface.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/qxl_surface.c b/src/qxl_surface.c
index a76db17..113f09b 100644
--- a/src/qxl_surface.c
+++ b/src/qxl_surface.c
@@ -732,10 +732,13 @@ qxl_surface_set_pixmap (qxl_surface_t *surface, PixmapPtr pixmap)
static void
unlink_surface (qxl_surface_t *surface)
{
- if (surface->prev)
- surface->prev->next = surface->next;
- else
- surface->cache->live_surfaces = surface->next;
+ if (surface->id != 0)
+ {
+ if (surface->prev)
+ surface->prev->next = surface->next;
+ else
+ surface->cache->live_surfaces = surface->next;
+ }
debug_surface_log(surface->cache);