mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 22:20:24 +00:00
testsuite: Don't leak so much
My subsurface attach code was leaking all the nodes. Oops.
This commit is contained in:
parent
eb84171cda
commit
9695791f7b
@ -27,6 +27,8 @@ node_attach (const GskRenderNode *node,
|
|||||||
GdkSurface *surface,
|
GdkSurface *surface,
|
||||||
int *idx)
|
int *idx)
|
||||||
{
|
{
|
||||||
|
GskRenderNode *child, *res;
|
||||||
|
|
||||||
switch (GSK_RENDER_NODE_TYPE (node))
|
switch (GSK_RENDER_NODE_TYPE (node))
|
||||||
{
|
{
|
||||||
case GSK_CAIRO_NODE:
|
case GSK_CAIRO_NODE:
|
||||||
@ -45,67 +47,98 @@ node_attach (const GskRenderNode *node,
|
|||||||
return gsk_render_node_ref ((GskRenderNode *)node);
|
return gsk_render_node_ref ((GskRenderNode *)node);
|
||||||
|
|
||||||
case GSK_TRANSFORM_NODE:
|
case GSK_TRANSFORM_NODE:
|
||||||
return gsk_transform_node_new (node_attach (gsk_transform_node_get_child (node), surface, idx),
|
child = node_attach (gsk_transform_node_get_child (node), surface, idx);
|
||||||
gsk_transform_node_get_transform (node));
|
res = gsk_transform_node_new (child, gsk_transform_node_get_transform (node));
|
||||||
|
gsk_render_node_unref (child);
|
||||||
|
return res;
|
||||||
|
|
||||||
case GSK_OPACITY_NODE:
|
case GSK_OPACITY_NODE:
|
||||||
return gsk_opacity_node_new (node_attach (gsk_opacity_node_get_child (node), surface, idx),
|
child = node_attach (gsk_opacity_node_get_child (node), surface, idx);
|
||||||
gsk_opacity_node_get_opacity (node));
|
res = gsk_opacity_node_new (child, gsk_opacity_node_get_opacity (node));
|
||||||
|
gsk_render_node_unref (child);
|
||||||
|
return res;
|
||||||
|
|
||||||
case GSK_COLOR_MATRIX_NODE:
|
case GSK_COLOR_MATRIX_NODE:
|
||||||
return gsk_color_matrix_node_new (node_attach (gsk_color_matrix_node_get_child (node), surface, idx),
|
child = node_attach (gsk_color_matrix_node_get_child (node), surface, idx);
|
||||||
|
res = gsk_color_matrix_node_new (child,
|
||||||
gsk_color_matrix_node_get_color_matrix (node),
|
gsk_color_matrix_node_get_color_matrix (node),
|
||||||
gsk_color_matrix_node_get_color_offset (node));
|
gsk_color_matrix_node_get_color_offset (node));
|
||||||
|
gsk_render_node_unref (child);
|
||||||
|
return res;
|
||||||
|
|
||||||
case GSK_REPEAT_NODE:
|
case GSK_REPEAT_NODE:
|
||||||
return gsk_repeat_node_new (&node->bounds,
|
child = node_attach (gsk_repeat_node_get_child (node), surface, idx);
|
||||||
node_attach (gsk_repeat_node_get_child (node), surface, idx),
|
res = gsk_repeat_node_new (&node->bounds, child, gsk_repeat_node_get_child_bounds (node));
|
||||||
gsk_repeat_node_get_child_bounds (node));
|
gsk_render_node_unref (child);
|
||||||
|
return res;
|
||||||
|
|
||||||
case GSK_CONTAINER_NODE:
|
case GSK_CONTAINER_NODE:
|
||||||
{
|
{
|
||||||
GskRenderNode **children = g_newa (GskRenderNode *, gsk_container_node_get_n_children (node));
|
GskRenderNode **children = g_newa (GskRenderNode *, gsk_container_node_get_n_children (node));
|
||||||
for (int i = 0; i < gsk_container_node_get_n_children (node); i++)
|
for (int i = 0; i < gsk_container_node_get_n_children (node); i++)
|
||||||
children[i] = node_attach (gsk_container_node_get_child (node, i), surface, idx);
|
children[i] = node_attach (gsk_container_node_get_child (node, i), surface, idx);
|
||||||
return gsk_container_node_new (children, gsk_container_node_get_n_children (node));
|
res = gsk_container_node_new (children, gsk_container_node_get_n_children (node));
|
||||||
|
for (int i = 0; i < gsk_container_node_get_n_children (node); i++)
|
||||||
|
gsk_render_node_unref (children[i]);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
case GSK_CLIP_NODE:
|
case GSK_CLIP_NODE:
|
||||||
return gsk_clip_node_new (node_attach (gsk_clip_node_get_child (node), surface, idx),
|
child = node_attach (gsk_clip_node_get_child (node), surface, idx);
|
||||||
gsk_clip_node_get_clip (node));
|
res = gsk_clip_node_new (child, gsk_clip_node_get_clip (node));
|
||||||
|
gsk_render_node_unref (child);
|
||||||
|
return res;
|
||||||
|
|
||||||
case GSK_ROUNDED_CLIP_NODE:
|
case GSK_ROUNDED_CLIP_NODE:
|
||||||
return gsk_rounded_clip_node_new (node_attach (gsk_rounded_clip_node_get_child (node), surface, idx),
|
child = node_attach (gsk_rounded_clip_node_get_child (node), surface, idx);
|
||||||
gsk_rounded_clip_node_get_clip (node));
|
res = gsk_rounded_clip_node_new (child, gsk_rounded_clip_node_get_clip (node));
|
||||||
|
gsk_render_node_unref (child);
|
||||||
|
return res;
|
||||||
|
|
||||||
case GSK_SHADOW_NODE:
|
case GSK_SHADOW_NODE:
|
||||||
{
|
{
|
||||||
GskShadow *shadows = g_newa (GskShadow, gsk_shadow_node_get_n_shadows (node));
|
GskShadow *shadows = g_newa (GskShadow, gsk_shadow_node_get_n_shadows (node));
|
||||||
for (int i = 0; i < gsk_shadow_node_get_n_shadows (node); i++)
|
for (int i = 0; i < gsk_shadow_node_get_n_shadows (node); i++)
|
||||||
shadows[i] = *gsk_shadow_node_get_shadow (node, i);
|
shadows[i] = *gsk_shadow_node_get_shadow (node, i);
|
||||||
|
child = node_attach (gsk_shadow_node_get_child (node), surface, idx);
|
||||||
return gsk_shadow_node_new (node_attach (gsk_shadow_node_get_child (node), surface, idx),
|
res = gsk_shadow_node_new (child, shadows, gsk_shadow_node_get_n_shadows (node));
|
||||||
shadows,
|
gsk_render_node_unref (child);
|
||||||
gsk_shadow_node_get_n_shadows (node));
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
case GSK_BLEND_NODE:
|
case GSK_BLEND_NODE:
|
||||||
return gsk_blend_node_new (node_attach (gsk_blend_node_get_bottom_child (node), surface, idx),
|
{
|
||||||
node_attach (gsk_blend_node_get_top_child (node), surface, idx),
|
GskRenderNode *top, *bottom;
|
||||||
gsk_blend_node_get_blend_mode (node));
|
bottom = node_attach (gsk_blend_node_get_bottom_child (node), surface, idx);
|
||||||
|
top = node_attach (gsk_blend_node_get_top_child (node), surface, idx);
|
||||||
|
res = gsk_blend_node_new (bottom, top, gsk_blend_node_get_blend_mode (node));
|
||||||
|
gsk_render_node_unref (bottom);
|
||||||
|
gsk_render_node_unref (top);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
case GSK_CROSS_FADE_NODE:
|
case GSK_CROSS_FADE_NODE:
|
||||||
return gsk_cross_fade_node_new (node_attach (gsk_cross_fade_node_get_start_child (node), surface, idx),
|
{
|
||||||
node_attach (gsk_cross_fade_node_get_end_child (node), surface, idx),
|
GskRenderNode *start, *end;
|
||||||
gsk_cross_fade_node_get_progress (node));
|
start = node_attach (gsk_cross_fade_node_get_start_child (node), surface, idx);
|
||||||
|
end = node_attach (gsk_cross_fade_node_get_end_child (node), surface, idx);
|
||||||
|
res = gsk_cross_fade_node_new (start, end, gsk_cross_fade_node_get_progress (node));
|
||||||
|
gsk_render_node_unref (start);
|
||||||
|
gsk_render_node_unref (end);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
case GSK_BLUR_NODE:
|
case GSK_BLUR_NODE:
|
||||||
return gsk_blur_node_new (node_attach (gsk_blur_node_get_child (node), surface, idx),
|
child = node_attach (gsk_blur_node_get_child (node), surface, idx);
|
||||||
gsk_blur_node_get_radius (node));
|
res = gsk_blur_node_new (child, gsk_blur_node_get_radius (node));
|
||||||
|
gsk_render_node_unref (child);
|
||||||
|
return res;
|
||||||
|
|
||||||
case GSK_DEBUG_NODE:
|
case GSK_DEBUG_NODE:
|
||||||
return gsk_debug_node_new (node_attach (gsk_debug_node_get_child (node), surface, idx),
|
child = node_attach (gsk_debug_node_get_child (node), surface, idx);
|
||||||
g_strdup (gsk_debug_node_get_message (node)));
|
res = gsk_debug_node_new (child, g_strdup (gsk_debug_node_get_message (node)));
|
||||||
|
gsk_render_node_unref (child);
|
||||||
|
return res;
|
||||||
|
|
||||||
case GSK_GL_SHADER_NODE:
|
case GSK_GL_SHADER_NODE:
|
||||||
{
|
{
|
||||||
@ -114,27 +147,42 @@ node_attach (const GskRenderNode *node,
|
|||||||
children = g_newa (GskRenderNode *, gsk_gl_shader_node_get_n_children (node));
|
children = g_newa (GskRenderNode *, gsk_gl_shader_node_get_n_children (node));
|
||||||
for (int i = 0; i < gsk_gl_shader_node_get_n_children (node); i++)
|
for (int i = 0; i < gsk_gl_shader_node_get_n_children (node); i++)
|
||||||
children[i] = node_attach (gsk_gl_shader_node_get_child (node, i), surface, idx);
|
children[i] = node_attach (gsk_gl_shader_node_get_child (node, i), surface, idx);
|
||||||
return gsk_gl_shader_node_new (gsk_gl_shader_node_get_shader (node),
|
res = gsk_gl_shader_node_new (gsk_gl_shader_node_get_shader (node),
|
||||||
&node->bounds,
|
&node->bounds,
|
||||||
gsk_gl_shader_node_get_args (node),
|
gsk_gl_shader_node_get_args (node),
|
||||||
children,
|
children,
|
||||||
gsk_gl_shader_node_get_n_children (node));
|
gsk_gl_shader_node_get_n_children (node));
|
||||||
|
for (int i = 0; i < gsk_gl_shader_node_get_n_children (node); i++)
|
||||||
|
gsk_render_node_unref (children[i]);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
case GSK_MASK_NODE:
|
case GSK_MASK_NODE:
|
||||||
return gsk_mask_node_new (node_attach (gsk_mask_node_get_source (node), surface, idx),
|
{
|
||||||
node_attach (gsk_mask_node_get_mask (node), surface, idx),
|
GskRenderNode *source, *mask;
|
||||||
gsk_mask_node_get_mask_mode (node));
|
source = node_attach (gsk_mask_node_get_source (node), surface, idx);
|
||||||
|
mask = node_attach (gsk_mask_node_get_mask (node), surface, idx);
|
||||||
|
res = gsk_mask_node_new (source, mask, gsk_mask_node_get_mask_mode (node));
|
||||||
|
gsk_render_node_unref (source);
|
||||||
|
gsk_render_node_unref (mask);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
case GSK_FILL_NODE:
|
case GSK_FILL_NODE:
|
||||||
return gsk_fill_node_new (node_attach (gsk_fill_node_get_child (node), surface, idx),
|
child = node_attach (gsk_fill_node_get_child (node), surface, idx);
|
||||||
gsk_fill_node_get_path (node),
|
res = gsk_fill_node_new (child,
|
||||||
gsk_fill_node_get_fill_rule (node));
|
gsk_fill_node_get_path (node),
|
||||||
|
gsk_fill_node_get_fill_rule (node));
|
||||||
|
gsk_render_node_unref (child);
|
||||||
|
return res;
|
||||||
|
|
||||||
case GSK_STROKE_NODE:
|
case GSK_STROKE_NODE:
|
||||||
return gsk_stroke_node_new (node_attach (gsk_stroke_node_get_child (node), surface, idx),
|
child = node_attach (gsk_stroke_node_get_child (node), surface, idx);
|
||||||
gsk_stroke_node_get_path (node),
|
res = gsk_stroke_node_new (child,
|
||||||
gsk_stroke_node_get_stroke (node));
|
gsk_stroke_node_get_path (node),
|
||||||
|
gsk_stroke_node_get_stroke (node));
|
||||||
|
gsk_render_node_unref (child);
|
||||||
|
return res;
|
||||||
|
|
||||||
case GSK_SUBSURFACE_NODE:
|
case GSK_SUBSURFACE_NODE:
|
||||||
{
|
{
|
||||||
@ -149,8 +197,10 @@ node_attach (const GskRenderNode *node,
|
|||||||
subsurface = gdk_surface_get_subsurface (surface, *idx);
|
subsurface = gdk_surface_get_subsurface (surface, *idx);
|
||||||
(*idx)++;
|
(*idx)++;
|
||||||
}
|
}
|
||||||
return gsk_subsurface_node_new (node_attach (gsk_subsurface_node_get_child (node), surface, idx),
|
child = node_attach (gsk_subsurface_node_get_child (node), surface, idx);
|
||||||
subsurface);
|
res = gsk_subsurface_node_new (child, subsurface);
|
||||||
|
gsk_render_node_unref (child);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
case GSK_NOT_A_RENDER_NODE:
|
case GSK_NOT_A_RENDER_NODE:
|
||||||
|
Loading…
Reference in New Issue
Block a user