Merge branch 'wip/baedert/for-master' into 'master'

Improve the valgrind experience

See merge request GNOME/gtk!984
This commit is contained in:
Matthias Clasen 2019-07-09 19:39:13 +00:00
commit bda3c6c084
18 changed files with 241 additions and 60 deletions

View File

@ -1405,8 +1405,10 @@ text_view_add_to_context_menu (GtkTextView *text_view)
item = g_menu_item_new (_("Underline"), "format.underline");
g_menu_item_set_attribute (item, "touch-icon", "s", "format-text-underline-symbolic");
g_menu_append_item (G_MENU (menu), item);
g_object_unref (item);
gtk_text_view_set_extra_menu (text_view, G_MENU_MODEL (menu));
g_object_unref (menu);
g_signal_connect (gtk_text_view_get_buffer (text_view), "changed", G_CALLBACK (text_changed), NULL);
g_signal_connect (gtk_text_view_get_buffer (text_view), "mark-set", G_CALLBACK (text_changed), NULL);

View File

@ -4432,7 +4432,6 @@ gtk_widget_realize
gtk_widget_unrealize
gtk_widget_queue_draw
gtk_widget_queue_resize
gtk_widget_queue_resize_no_redraw
gtk_widget_queue_allocate
gtk_widget_get_frame_clock
gtk_widget_get_scale_factor
@ -4604,7 +4603,6 @@ gtk_widget_get_vexpand
gtk_widget_set_vexpand
gtk_widget_get_vexpand_set
gtk_widget_set_vexpand_set
gtk_widget_queue_compute_expand
gtk_widget_compute_expand
<SUBSECTION Templates>

View File

@ -2342,6 +2342,7 @@ gsk_gl_renderer_dispose (GObject *gobject)
GskGLRenderer *self = GSK_GL_RENDERER (gobject);
g_clear_pointer (&self->render_ops, g_array_unref);
ops_free (&self->op_builder);
G_OBJECT_CLASS (gsk_gl_renderer_parent_class)->dispose (gobject);
}

View File

@ -187,6 +187,17 @@ ops_init (RenderOpBuilder *builder)
}
}
void
ops_free (RenderOpBuilder *builder)
{
int i;
for (i = 0; i < GL_N_PROGRAMS; i ++)
{
gsk_transform_unref (builder->program_state[i].modelview);
}
}
void
ops_set_program (RenderOpBuilder *builder,
const Program *program)
@ -225,6 +236,7 @@ ops_set_program (RenderOpBuilder *builder,
op.op = OP_CHANGE_MODELVIEW;
gsk_transform_to_matrix (builder->current_modelview, &op.modelview);
g_array_append_val (builder->render_ops, op);
gsk_transform_unref (program_state->modelview);
program_state->modelview = gsk_transform_ref (builder->current_modelview);
}

View File

@ -290,6 +290,7 @@ void ops_dump_framebuffer (RenderOpBuilder *builder,
int width,
int height);
void ops_init (RenderOpBuilder *builder);
void ops_free (RenderOpBuilder *builder);
void ops_push_debug_group (RenderOpBuilder *builder,
const char *text);
void ops_pop_debug_group (RenderOpBuilder *builder);

View File

@ -646,7 +646,7 @@ gsk_transform_translate_3d (GskTransform *next,
GskTranslateTransform *result;
if (graphene_point3d_equal (point, graphene_point3d_zero ()))
return gsk_transform_ref (next);
return next;
if (gsk_transform_has_class (next, &GSK_TRANSLATE_TRANSFORM_CLASS))
{
@ -801,7 +801,7 @@ gsk_transform_rotate (GskTransform *next,
GskRotateTransform *result;
if (angle == 0.0f)
return gsk_transform_ref (next);
return next;
if (gsk_transform_has_class (next, &GSK_ROTATE_TRANSFORM_CLASS))
{
@ -932,7 +932,7 @@ gsk_transform_rotate_3d (GskTransform *next,
return gsk_transform_rotate (next, angle);
if (angle == 0.0f)
return gsk_transform_ref (next);
return next;
result = gsk_transform_alloc (&GSK_ROTATE3D_TRANSFORM_CLASS,
GSK_TRANSFORM_CATEGORY_3D,
@ -1121,7 +1121,7 @@ gsk_transform_scale_3d (GskTransform *next,
GskScaleTransform *result;
if (factor_x == 1 && factor_y == 1 && factor_z == 1)
return gsk_transform_ref (next);
return next;
if (gsk_transform_has_class (next, &GSK_SCALE_TRANSFORM_CLASS))
{
@ -1250,7 +1250,7 @@ gsk_transform_perspective (GskTransform *next,
float depth)
{
GskPerspectiveTransform *result;
if (gsk_transform_has_class (next, &GSK_PERSPECTIVE_TRANSFORM_CLASS))
{
GskTransform *r = gsk_transform_perspective (gsk_transform_ref (next->next),

152
gtk.supp Normal file
View File

@ -0,0 +1,152 @@
# Actual GTK things
{
GtkWidgetClass action GPtrArray
Memcheck:Leak
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_ptr_array_sized_new
fun:g_ptr_array_new
fun:gtk_widget_class_add_action
}
{
GTK media extension gio modules
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:g_slice_alloc
fun:g_slice_alloc0
fun:g_type_create_instance
fun:g_object_new_internal
fun:g_object_new_with_properties
fun:g_object_new
fun:g_io_module_new
fun:g_io_modules_scan_all_in_directory_with_scope
fun:gtk_media_file_extension_init
}
# mesa driver stuff
{
i965 addr4
Memcheck:Addr4
obj:/usr/lib/dri/i965_dri.so*
}
{
i965 addr8
Memcheck:Addr8
obj:/usr/lib/dri/i965_dri.so*
}
{
i965 memcpy
Memcheck:Addr8
fun:memcpy*
obj:/usr/lib/dri/i965_dri.so*
}
{
i965 memcpy
Memcheck:Addr2
fun:memcpy*
obj:/usr/lib/dri/i965_dri.so*
}
{
mesa memcmp 8
Memcheck:Addr8
fun:*memcmp*
obj:/usr/lib/dri/i965_dri.so*
}
{
mesa memcmp 1
Memcheck:Addr1
fun:*memcmp*
obj:/usr/lib/dri/i965_dri.so*
}
{
mesa memset 8
Memcheck:Addr8
fun:*memset*
obj:/usr/lib/dri/i965_dri.so
}
{
mesa realpath
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:realpath@@GLIBC_2.3
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
fun:epoxy_eglInitialize_global_rewrite_ptr
}
{
mesa calloc
Memcheck:Leak
match-leak-kinds: definite
fun:calloc
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
fun:epoxy_eglInitialize_global_rewrite_ptr
}
{
mesa malloc
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/lib/dri/i965_dri.so*
}
# Fontconfig
{
FcFontSetList
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/lib/libfontconfig.so*
obj:/usr/lib/libfontconfig.so*
fun:FcFontSetList
}
{
FcFontRenderPrepare
Memcheck:Leak
match-leak-kinds: definite
fun:realloc
obj:/usr/lib/libfontconfig.so*
obj:/usr/lib/libfontconfig.so*
fun:FcFontRenderPrepare
}
# Pango
{
pango 1
Memcheck:Leak
match-leak-kinds: definite
fun:realloc
obj:/usr/lib/libfontconfig.so*
obj:/usr/lib/libfontconfig.so*
obj:/usr/lib/libcairo.so*
fun:pango_cairo_fc_font_map_fontset_key_substitute
}

View File

@ -803,6 +803,8 @@ gtk_action_muxer_finalize (GObject *object)
if (muxer->primary_accels)
g_hash_table_unref (muxer->primary_accels);
g_free (muxer->widget_actions_enabled);
G_OBJECT_CLASS (gtk_action_muxer_parent_class)
->finalize (object);
}

View File

@ -3474,7 +3474,7 @@ gtk_calendar_set_detail_width_chars (GtkCalendar *calendar,
{
priv->detail_width_chars = chars;
g_object_notify (G_OBJECT (calendar), "detail-width-chars");
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (calendar));
gtk_widget_queue_resize (GTK_WIDGET (calendar));
}
}
@ -3498,7 +3498,7 @@ gtk_calendar_set_detail_height_rows (GtkCalendar *calendar,
{
priv->detail_height_rows = rows;
g_object_notify (G_OBJECT (calendar), "detail-height-rows");
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (calendar));
gtk_widget_queue_resize (GTK_WIDGET (calendar));
}
}

View File

@ -1118,6 +1118,8 @@ gtk_css_provider_load_internal (GtkCssProvider *self,
if (parent == NULL)
gtk_css_provider_postprocess (self);
g_bytes_unref (bytes);
}
}
@ -1149,8 +1151,8 @@ gtk_css_provider_load_from_data (GtkCssProvider *css_provider,
gtk_css_provider_reset (css_provider);
g_bytes_ref (bytes);
gtk_css_provider_load_internal (css_provider, NULL, NULL, bytes);
g_bytes_unref (bytes);
gtk_style_provider_changed (GTK_STYLE_PROVIDER (css_provider));

View File

@ -227,19 +227,35 @@ gtk_icon_helper_paintable_snapshot (GdkPaintable *paintable,
h = MIN (h, height);
x = (width - w) / 2;
y = (height - h) / 2;
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
gtk_css_style_snapshot_icon_paintable (style,
snapshot,
self->paintable,
w, h,
self->texture_is_symbolic);
gtk_snapshot_restore (snapshot);
if (x != 0 || y != 0)
{
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
gtk_css_style_snapshot_icon_paintable (style,
snapshot,
self->paintable,
w, h,
self->texture_is_symbolic);
gtk_snapshot_restore (snapshot);
}
else
{
gtk_css_style_snapshot_icon_paintable (style,
snapshot,
self->paintable,
w, h,
self->texture_is_symbolic);
}
}
break;
case GTK_IMAGE_PAINTABLE:
case GTK_IMAGE_EMPTY:
break;
case GTK_IMAGE_PAINTABLE:
default:
{
double image_ratio = (double) width / height;
@ -269,14 +285,25 @@ gtk_icon_helper_paintable_snapshot (GdkPaintable *paintable,
x = floor (width - ceil (w)) / 2;
y = floor (height - ceil (h)) / 2;
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
gtk_css_style_snapshot_icon_paintable (style,
snapshot,
self->paintable,
w, h,
self->texture_is_symbolic);
gtk_snapshot_restore (snapshot);
if (x != 0 || y != 0)
{
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
gtk_css_style_snapshot_icon_paintable (style,
snapshot,
self->paintable,
w, h,
self->texture_is_symbolic);
gtk_snapshot_restore (snapshot);
}
else
{
gtk_css_style_snapshot_icon_paintable (style,
snapshot,
self->paintable,
w, h,
self->texture_is_symbolic);
}
}
break;
}

View File

@ -4449,7 +4449,7 @@ changed_handler (GtkTextLayout *layout,
tmp_list = tmp_list->next;
}
gtk_widget_queue_resize_no_redraw(widget);
gtk_widget_queue_resize(widget);
}
}

View File

@ -933,13 +933,13 @@ slide_idle_handler (gpointer data)
if (cont)
{
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (toolbar));
gtk_widget_queue_resize (GTK_WIDGET (toolbar));
return TRUE;
}
}
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (toolbar));
gtk_widget_queue_resize (GTK_WIDGET (toolbar));
priv->is_sliding = FALSE;
priv->idle_id = 0;
@ -1052,7 +1052,7 @@ gtk_toolbar_begin_sliding (GtkToolbar *toolbar)
* so that the idle handler will not immediately return
* FALSE
*/
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (toolbar));
gtk_widget_queue_resize (GTK_WIDGET (toolbar));
g_timer_reset (priv->timer);
}
@ -1086,7 +1086,7 @@ gtk_toolbar_stop_sliding (GtkToolbar *toolbar)
}
}
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (toolbar));
gtk_widget_queue_resize (GTK_WIDGET (toolbar));
}
}

View File

@ -6311,7 +6311,7 @@ do_validate_rows (GtkTreeView *tree_view, gboolean queue_resize)
MAX (gtk_adjustment_get_upper (tree_view->priv->vadjustment), requisition.height));
if (queue_resize)
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (tree_view));
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
if (path) gtk_tree_path_free (path);
@ -8319,7 +8319,7 @@ gtk_tree_view_row_inserted (GtkTreeModel *model,
if (node_visible && node_is_visible (tree_view, tree, tmpnode))
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
else
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (tree_view));
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
else
install_presize_handler (tree_view);

View File

@ -713,6 +713,8 @@ static gboolean gtk_widget_class_get_visible_by_default (GtkWidgetClass *widget_
static void remove_parent_surface_transform_changed_listener (GtkWidget *widget);
static void add_parent_surface_transform_changed_listener (GtkWidget *widget);
static void gtk_widget_queue_compute_expand (GtkWidget *widget);
/* --- variables --- */
@ -4159,21 +4161,6 @@ gtk_widget_queue_resize (GtkWidget *widget)
gtk_widget_queue_resize_internal (widget);
}
/**
* gtk_widget_queue_resize_no_redraw:
* @widget: a #GtkWidget
*
* This function works like gtk_widget_queue_resize(),
* except that the widget is not invalidated.
**/
void
gtk_widget_queue_resize_no_redraw (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
gtk_widget_queue_resize_internal (widget);
}
/**
* gtk_widget_get_frame_clock:
* @widget: a #GtkWidget
@ -4468,6 +4455,7 @@ gtk_widget_allocate (GtkWidget *widget,
if (adjusted.x || adjusted.y)
transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (adjusted.x, adjusted.y));
gsk_transform_unref (priv->transform);
priv->transform = transform;
if (priv->surface_transform_data)
@ -8954,7 +8942,7 @@ gtk_widget_update_computed_expand (GtkWidget *widget)
*
* See gtk_widget_compute_expand().
*/
void
static void
gtk_widget_queue_compute_expand (GtkWidget *widget)
{
GtkWidget *parent;

View File

@ -375,8 +375,6 @@ void gtk_widget_queue_draw (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_widget_queue_resize (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_widget_queue_resize_no_redraw (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_widget_queue_allocate (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
GdkFrameClock* gtk_widget_get_frame_clock (GtkWidget *widget);
@ -645,8 +643,6 @@ GDK_AVAILABLE_IN_ALL
void gtk_widget_set_vexpand_set (GtkWidget *widget,
gboolean set);
GDK_AVAILABLE_IN_ALL
void gtk_widget_queue_compute_expand (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
gboolean gtk_widget_compute_expand (GtkWidget *widget,
GtkOrientation orientation);

View File

@ -4367,7 +4367,7 @@ gtk_window_set_default_size_internal (GtkWindow *window,
g_object_thaw_notify (G_OBJECT (window));
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
gtk_widget_queue_resize (GTK_WIDGET (window));
}
/**
@ -4498,7 +4498,7 @@ gtk_window_resize (GtkWindow *window,
info->resize_width = width;
info->resize_height = height;
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
gtk_widget_queue_resize (GTK_WIDGET (window));
}
/**
@ -7129,7 +7129,7 @@ gtk_window_move_resize (GtkWindow *window)
* to postpone our configure request until later.
*/
info->last = saved_last_info;
gtk_widget_queue_resize_no_redraw (widget); /* might recurse for GTK_RESIZE_IMMEDIATE */
gtk_widget_queue_resize (widget); /* might recurse for GTK_RESIZE_IMMEDIATE */
}
return; /* Bail out, we didn't really process the move/resize */
@ -7963,7 +7963,7 @@ gtk_window_set_resizable (GtkWindow *window,
update_window_buttons (window);
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
gtk_widget_queue_resize (GTK_WIDGET (window));
g_object_notify_by_pspec (G_OBJECT (window), window_props[PROP_RESIZABLE]);
}

View File

@ -44,8 +44,8 @@ get_output_dir (void)
}
g_error_free (error);
}
g_object_unref (file);
else
g_object_unref (file);
return output_dir;
}