From 6973283a77d7becd6a5a1bd7396206c6840ca785 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Wed, 13 Jul 2011 23:43:55 +0200 Subject: Fix crashes in print preview Fixed bugs: - https://launchpad.net/bugs/806105 (bzr r10450) --- src/display/cairo-utils.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/display/cairo-utils.cpp') diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp index 90f65c33e..8b75f09a6 100644 --- a/src/display/cairo-utils.cpp +++ b/src/display/cairo-utils.cpp @@ -345,6 +345,18 @@ ink_cairo_surface_create_for_argb32_pixbuf(GdkPixbuf *pb) return pbs; } +/** @brief Cleanup function for GdkPixbuf. + * This function should be passed as the GdkPixbufDestroyNotify parameter + * to gdk_pixbuf_new_from_data when creating a GdkPixbuf backed by + * a Cairo surface. + */ +void +ink_cairo_pixbuf_cleanup(guchar *pixels, void *data) +{ + cairo_surface_t *surface = reinterpret_cast(data); + cairo_surface_destroy(surface); +} + /** @brief Create an exact copy of a surface. * Creates a surface that has the same type, content type, dimensions and contents * as the specified surface. */ -- cgit v1.2.3