[cairo] [cairo-commit] 2 commits - src/cairo-surface.c

Chris Wilson chris at chris-wilson.co.uk
Thu Dec 30 01:18:12 PST 2010


Minor comment on another wise good patch.

On Wed, 29 Dec 2010 10:07:30 -0800 (PST), ranma42 at kemper.freedesktop.org (Andrea Canciani) wrote:
> commit 59ac884c607c024d0608cf7dec52509d9e9e328e
> Author: Uli Schlachter <psychon at znc.in>
> Date:   Sat Dec 25 23:39:21 2010 +0100
> 
>     Verify that surfaces leak no snapshots
>     
>     Finished surfaces should own no snapshots, because finished surfaces
>     can't be used as sources, thus their snapshots would never be used.
>     
>     When free'ing the surface in cairo_surface_destroy(), it should have
>     no snapshots, or they will be leaked.
>     
>     Signed-off-by: Uli Schlachter <psychon at znc.in>
> 
> diff --git a/src/cairo-surface.c b/src/cairo-surface.c
> index 01ea27a..bc80d08 100644
> --- a/src/cairo-surface.c
> +++ b/src/cairo-surface.c
> @@ -654,6 +654,9 @@ cairo_surface_destroy (cairo_surface_t *surface)
>      if (surface->owns_device)
>          cairo_device_destroy (surface->device);
>  
> +    assert (surface->snapshot_of == NULL);
> +    assert (!_cairo_surface_has_snapshots (surface));

We like a space between the logical negation and its object:

  assert (! _cairo_surface_has_snapshots (surface));

It just helps to make that operator more clear in dense code.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list