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

directorylist: Fix file monitoring implementation

See merge request GNOME/gtk!2209
This commit is contained in:
Matthias Clasen 2020-07-09 02:08:53 +00:00
commit 8fb1e33d0f
14 changed files with 54 additions and 28 deletions

View File

@ -41,6 +41,7 @@ RUN dnf -y install \
itstool \
json-glib-devel \
lcov \
libasan \
libattr-devel \
libepoxy-devel \
libffi-devel \

View File

@ -123,7 +123,8 @@ gsk_transform_alloc (const GskTransformClass *transform_class,
self->transform_class = transform_class;
self->category = next ? MIN (category, next->category) : category;
self->next = gsk_transform_is_identity (next) ? NULL : next;
self->next = gsk_transform_is_identity (next) ? NULL : gsk_transform_ref (next);
g_clear_pointer (&next, gsk_transform_unref);
return self;
}

View File

@ -369,6 +369,8 @@ gtk_bookmark_list_start_loading (GtkBookmarkList *self)
self);
g_object_unref (file);
}
g_strfreev (uris);
}
else
{

View File

@ -768,7 +768,11 @@ parse_selector_list (GtkCssScanner *scanner,
GtkCssSelector *select = _gtk_css_selector_parse (scanner->parser);
if (select == NULL)
return 0;
{
for (int i = 0; i < n_selectors; i++)
g_clear_pointer (&out_selectors[i], _gtk_css_selector_free);
return 0;
}
out_selectors[n_selectors] = select;
n_selectors++;
@ -778,6 +782,8 @@ parse_selector_list (GtkCssScanner *scanner,
gtk_css_parser_error_syntax (scanner->parser,
"Only %u selectors per ruleset allowed",
MAX_SELECTOR_LIST_LENGTH);
for (int i = 0; i < MAX_SELECTOR_LIST_LENGTH; i++)
g_clear_pointer (&out_selectors[i], _gtk_css_selector_free);
return 0;
}
}
@ -806,10 +812,7 @@ parse_declaration (GtkCssScanner *scanner,
name = gtk_css_parser_consume_ident (scanner->parser);
if (name == NULL)
{
gtk_css_parser_end_block (scanner->parser);
return;
}
goto out;
property = _gtk_style_property_lookup (name);
@ -821,25 +824,18 @@ parse_declaration (GtkCssScanner *scanner,
if (!gtk_css_parser_try_token (scanner->parser, GTK_CSS_TOKEN_COLON))
{
gtk_css_parser_error_syntax (scanner->parser, "Expected ':'");
g_free (name);
gtk_css_parser_end_block (scanner->parser);
return;
goto out;
}
value = _gtk_style_property_parse_value (property,
scanner->parser);
value = _gtk_style_property_parse_value (property, scanner->parser);
if (value == NULL)
{
gtk_css_parser_end_block (scanner->parser);
return;
}
goto out;
if (!gtk_css_parser_has_token (scanner->parser, GTK_CSS_TOKEN_EOF))
{
gtk_css_parser_error_syntax (scanner->parser, "Junk at end of value for %s", property->name);
gtk_css_parser_end_block (scanner->parser);
return;
goto out;
}
if (gtk_keep_css_sections)
@ -884,6 +880,7 @@ parse_declaration (GtkCssScanner *scanner,
gtk_css_parser_error_value (scanner->parser, "No property named \"%s\"", name);
}
out:
g_free (name);
gtk_css_parser_end_block (scanner->parser);

View File

@ -570,8 +570,9 @@ got_existing_file_info_cb (GObject *source,
g_file_info_set_attribute_object (info, "standard::file", G_OBJECT (file));
iter = g_sequence_get_begin_iter (self->items);
while (!g_sequence_iter_is_end (iter))
for (iter = g_sequence_get_begin_iter (self->items);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
GFileInfo *item = g_sequence_get (iter);
GFile *f = G_FILE (g_file_info_get_attribute_object (item, "standard::file"));
@ -591,8 +592,9 @@ gtk_directory_list_remove_file (GtkDirectoryList *self,
{
GSequenceIter *iter;
iter = g_sequence_get_begin_iter (self->items);
while (!g_sequence_iter_is_end (iter))
for (iter = g_sequence_get_begin_iter (self->items);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
GFileInfo *item = g_sequence_get (iter);
GFile *f = G_FILE (g_file_info_get_attribute_object (item, "standard::file"));

View File

@ -284,6 +284,7 @@ gtk_picture_dispose (GObject *object)
gtk_picture_set_paintable (self, NULL);
g_clear_object (&self->file);
g_clear_pointer (&self->alternative_text, g_free);
G_OBJECT_CLASS (gtk_picture_parent_class)->dispose (object);
};

View File

@ -142,11 +142,17 @@ gtk_shortcut_trigger_parse_string (const char *string)
/* empty first slot */
if (*frag_a == '\0')
return NULL;
{
g_free (frag_a);
return NULL;
}
/* empty second slot */
if (*frag_b == '\0')
return NULL;
{
g_free (frag_a);
return NULL;
}
t1 = gtk_shortcut_trigger_parse_string (frag_a);
if (t1 == NULL)

View File

@ -93,7 +93,7 @@ create_texture (GdkMemoryFormat format,
guchar *data;
int x, y;
data = g_malloc (height * stride);
data = g_malloc (height * MAX (stride, tests[format].bytes_per_pixel));
for (y = 0; y < height; y++)
for (x = 0; x < width; x++)
{
@ -102,7 +102,7 @@ create_texture (GdkMemoryFormat format,
tests[format].bytes_per_pixel);
}
bytes = g_bytes_new_static (data, height * stride);
bytes = g_bytes_new_take (data, height * MAX (stride, tests[format].bytes_per_pixel));
texture = gdk_memory_texture_new (width, height,
format,
bytes,

View File

@ -316,7 +316,13 @@ test_subtract_hardcoded (void)
left_str++;
}
g_test_message ("%s - %s\n", _gtk_bitmask_to_string (left), _gtk_bitmask_to_string (right));
{
char *sl = _gtk_bitmask_to_string (left);
char *sr = _gtk_bitmask_to_string (right);
g_test_message ("%s - %s\n", sl, sr);
g_free (sl);
g_free (sr);
}
subtracted = _gtk_bitmask_subtract (_gtk_bitmask_copy (left), right);
assert_cmpmasks (subtracted, expected);

View File

@ -5971,6 +5971,7 @@ specific_bug_346800 (void)
columns[1] = G_TYPE_BOOLEAN;
store = gtk_tree_store_newv (2, columns);
model = GTK_TREE_MODEL (store);
GList *junk = NULL;
/*http://bugzilla.gnome.org/show_bug.cgi?id=346800 */
@ -5981,14 +5982,14 @@ specific_bug_346800 (void)
{
/* allocate random amounts of junk, otherwise the filter model's arrays can expand without moving */
g_malloc (138);
junk = g_list_append (junk, g_malloc (138));
gtk_tree_store_append (store, &node_iters[i], NULL);
gtk_tree_store_set (store, &node_iters[i],
0, "something",
1, ((i%6) == 0) ? FALSE : TRUE,
-1);
g_malloc (47);
junk = g_list_append (junk, g_malloc (47));
gtk_tree_store_append (store, &child_iters[i], &node_iters[i]);
gtk_tree_store_set (store, &child_iters[i],
0, "something else",
@ -6007,6 +6008,8 @@ specific_bug_346800 (void)
gtk_tree_model_filter_refilter (filter);
}
}
g_list_free_full (junk, g_free);
}
static gboolean

View File

@ -354,6 +354,8 @@ test_trigger_trigger (void)
}
gdk_event_unref (event);
g_free (keys);
}
gdk_surface_destroy (surface);

View File

@ -304,6 +304,7 @@ main (int argc, char **argv)
g_error ("Option parsing failed: %s\n", error->message);
return 1;
}
g_option_context_free (context);
gtk_init ();

View File

@ -1360,6 +1360,7 @@ check_buffer_contents (GtkTextBuffer *buffer,
gtk_text_buffer_get_end_iter (buffer, &end);
buffer_contents = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
g_assert_cmpstr (buffer_contents, ==, contents);
g_free (buffer_contents);
}
static void

View File

@ -78,6 +78,7 @@ parse_command_line (int *argc, char ***argv)
g_print ("option parsing failed: %s\n", error->message);
return FALSE;
}
g_option_context_free (context);
for (i = 0; i < *argc; i++)
{
@ -325,6 +326,8 @@ test_ui_file (GFile *file)
}
remove_extra_css (provider);
g_free (ui_file);
}
static int