Set freed pointer to NULL.

Fix to actually set surface->finished when done. Closes bug #2950 as documented in test/surface-finish-twice.c.
Note that this bug is fixed.
This commit is contained in:
Carl Worth 2005-04-13 14:51:59 +00:00
parent 0fe6378bdb
commit 66688da5e4
4 changed files with 27 additions and 3 deletions

View file

@ -1,3 +1,14 @@
2005-04-13 Carl Worth <cworth@cworth.org>
* src/cairo-image-surface.c:
(_cairo_image_abstract_surface_finish): Set freed pointer to NULL.
* src/cairo-surface.c: (cairo_surface_finish): Fix to actually set
surface->finished when done. Closes bug #2950 as documented in
test/surface-finish-twice.c.
* test/surface-finish-twice.c: Note that this bug is fixed.
2005-04-13 Carl Worth <cworth@cworth.org>
* test/.cvsignore:

View file

@ -240,8 +240,10 @@ _cairo_image_abstract_surface_finish (void *abstract_surface)
{
cairo_image_surface_t *surface = abstract_surface;
if (surface->pixman_image)
if (surface->pixman_image) {
pixman_image_destroy (surface->pixman_image);
surface->pixman_image = NULL;
}
if (surface->owns_data) {
free (surface->data);

View file

@ -168,11 +168,18 @@ slim_hidden_def(cairo_surface_destroy);
cairo_status_t
cairo_surface_finish (cairo_surface_t *surface)
{
cairo_status_t status;
if (surface->finished)
return CAIRO_STATUS_SURFACE_FINISHED;
if (surface->backend->finish)
return surface->backend->finish (surface);
if (surface->backend->finish) {
status = surface->backend->finish (surface);
if (status)
return status;
}
surface->finished = TRUE;
return CAIRO_STATUS_SUCCESS;
}

View file

@ -34,6 +34,10 @@
*
* *** glibc detected *** double free or corruption: 0x082a7268 ***
* Aborted
*
* 2005-04-13 Carl Worth <cworth@cworth.org>
*
* Looks like surface->finished was never being set. Now fixed.
*/
#include "cairo-test.h"