compositor: Discard surface.frame if the surface isn't visible
authorKristian Høgsberg <krh@bitplanet.net>
Mon, 29 Aug 2011 20:09:32 +0000 (16:09 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Mon, 29 Aug 2011 21:12:37 +0000 (17:12 -0400)
compositor/compositor.c

index d3e7b09..b068df6 100644 (file)
@@ -253,6 +253,7 @@ wlsc_surface_create(struct wlsc_compositor *compositor,
        surface->height = height;
 
        surface->buffer = NULL;
+       surface->output = NULL;
 
        pixman_region32_init(&surface->damage);
        pixman_region32_init(&surface->opaque);
@@ -1078,9 +1079,16 @@ surface_frame(struct wl_client *client,
        cb->resource.destroy = destroy_frame_callback;
        cb->resource.client = client;
        cb->resource.data = cb;
-       wl_list_insert(es->output->frame_callback_list.prev, &cb->link);
 
        wl_client_add_resource(client, &cb->resource);
+
+       if (es->output) {
+               wl_list_insert(es->output->frame_callback_list.prev,
+                              &cb->link);
+       } else {
+               wl_list_init(&cb->link);
+               wl_resource_destroy(&cb->resource, 0);
+       }
 }
 
 const static struct wl_surface_interface surface_interface = {