comparison gtk4/dw.c @ 2316:1f85311baa65

GTK4: dw_pixmap_new_from_data() should return NULL on failure. Move dw_pixmap_destroy() into thread safety.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 16 Feb 2021 05:22:28 +0000
parents 112595f9a645
children a2020f907a6c
comparison
equal deleted inserted replaced
2315:112595f9a645 2316:1f85311baa65
6843 pixmap->height = gdk_pixbuf_get_height(pixmap->pixbuf); 6843 pixmap->height = gdk_pixbuf_get_height(pixmap->pixbuf);
6844 /* remove our temporary file */ 6844 /* remove our temporary file */
6845 unlink(template); 6845 unlink(template);
6846 pixmap->handle = handle; 6846 pixmap->handle = handle;
6847 } 6847 }
6848 else
6849 {
6850 free(pixmap);
6851 pixmap = 0;
6852 }
6848 } 6853 }
6849 DW_FUNCTION_RETURN_THIS(pixmap); 6854 DW_FUNCTION_RETURN_THIS(pixmap);
6850 } 6855 }
6851 6856
6852 /* 6857 /*
6922 * Destroys an allocated pixmap. 6927 * Destroys an allocated pixmap.
6923 * Parameters: 6928 * Parameters:
6924 * pixmap: Handle to a pixmap returned by 6929 * pixmap: Handle to a pixmap returned by
6925 * dw_pixmap_new.. 6930 * dw_pixmap_new..
6926 */ 6931 */
6927 void dw_pixmap_destroy(HPIXMAP pixmap) 6932 DW_FUNCTION_DEFINITION(dw_pixmap_destroy, void, HPIXMAP pixmap)
6933 DW_FUNCTION_ADD_PARAM1(pixmap)
6934 DW_FUNCTION_NO_RETURN(dw_pixmap_destroy)
6935 DW_FUNCTION_RESTORE_PARAM1(pixmap, HPIXMAP)
6928 { 6936 {
6929 g_object_unref(G_OBJECT(pixmap->pixbuf)); 6937 g_object_unref(G_OBJECT(pixmap->pixbuf));
6930 cairo_surface_destroy(pixmap->image); 6938 cairo_surface_destroy(pixmap->image);
6931 if(pixmap->font) 6939 if(pixmap->font)
6932 free(pixmap->font); 6940 free(pixmap->font);
6933 free(pixmap); 6941 free(pixmap);
6942 DW_FUNCTION_RETURN_NOTHING;
6934 } 6943 }
6935 6944
6936 /* 6945 /*
6937 * Copies from one item to another. 6946 * Copies from one item to another.
6938 * Parameters: 6947 * Parameters: