Merge branch 'matthiasc/for-main' into 'main'

gsk: Add an assertion to help static analysis

See merge request GNOME/gtk!5224
This commit is contained in:
Matthias Clasen 2022-11-18 05:22:44 +00:00
commit dfbaeefc64
4 changed files with 13 additions and 3 deletions

View File

@ -141,7 +141,7 @@ gdk_load_jpeg (GBytes *input_bytes,
struct jpeg_decompress_struct info;
struct error_handler_data jerr;
guint width, height, stride;
unsigned char *data;
unsigned char *data = NULL;
unsigned char *row[1];
GBytes *bytes;
GdkTexture *texture;
@ -155,6 +155,7 @@ gdk_load_jpeg (GBytes *input_bytes,
if (sigsetjmp (jerr.setjmp_buffer, 1))
{
g_free (data);
jpeg_destroy_decompress (&info);
return NULL;
}
@ -247,7 +248,7 @@ gdk_save_jpeg (GdkTexture *texture)
struct jpeg_compress_struct info;
struct error_handler_data jerr;
struct jpeg_error_mgr err;
guchar *data;
guchar *data = NULL;
gulong size = 0;
guchar *input = NULL;
GdkMemoryTexture *memtex = NULL;

View File

@ -4818,6 +4818,8 @@ blur_image_surface (cairo_surface_t *surface, int radius, int iterations)
cairo_surface_t *tmp;
int width, height;
g_assert (radius >= 0);
width = cairo_image_surface_get_width (surface);
height = cairo_image_surface_get_height (surface);
tmp = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);

View File

@ -963,6 +963,7 @@ parser_get_compose_table (GtkComposeParser *parser)
if (char_data->len >= 0x8000)
{
g_warning ("GTK can't handle compose tables this large (%s)", parser->compose_file ? parser->compose_file : "");
g_free (data);
g_string_free (char_data, TRUE);
return NULL;
}

View File

@ -86,14 +86,20 @@ gtk_string_sorter_get_key (GtkExpression *expression,
switch (collation)
{
case GTK_COLLATION_NONE:
key = s;
if (ignore_case)
key = g_steal_pointer (&s);
else
key = g_strdup (s);
break;
case GTK_COLLATION_UNICODE:
key = g_utf8_collate_key (s, -1);
break;
case GTK_COLLATION_FILENAME:
key = g_utf8_collate_key_for_filename (s, -1);
break;
default:
g_assert_not_reached ();
break;