gsk: Add GskRenderNodeClass.finalize()

This commit is contained in:
Benjamin Otte 2016-12-11 04:18:25 +01:00
parent a97b819b81
commit be8b9406e5
3 changed files with 27 additions and 5 deletions

View File

@ -74,8 +74,8 @@ gsk_render_node_finalize (GskRenderNode *self)
{
self->is_mutable = TRUE;
g_clear_pointer (&self->surface, cairo_surface_destroy);
g_clear_pointer (&self->texture, gsk_texture_unref);
self->node_class->finalize (self);
g_clear_pointer (&self->name, g_free);
while (self->first_child)

View File

@ -24,9 +24,16 @@
/*** GSK_TEXTURE_NODE ***/
static void
gsk_texture_node_finalize (GskRenderNode *node)
{
gsk_texture_unref (node->texture);
}
static const GskRenderNodeClass GSK_TEXTURE_NODE_CLASS = {
GSK_TEXTURE_NODE,
"GskTextureNode"
"GskTextureNode",
gsk_texture_node_finalize
};
GskTexture *
@ -68,9 +75,17 @@ gsk_texture_node_new (GskTexture *texture,
/*** GSK_CAIRO_NODE ***/
static void
gsk_cairo_node_finalize (GskRenderNode *node)
{
if (node->surface)
cairo_surface_destroy (node->surface);
}
static const GskRenderNodeClass GSK_CAIRO_NODE_CLASS = {
GSK_CAIRO_NODE,
"GskCairoNode"
"GskCairoNode",
gsk_cairo_node_finalize
};
/*< private >
@ -203,9 +218,15 @@ gsk_cairo_node_get_draw_context (GskRenderNode *node,
/**** GSK_CONTAINER_NODE ***/
static void
gsk_container_node_finalize (GskRenderNode *node)
{
}
static const GskRenderNodeClass GSK_CONTAINER_NODE_CLASS = {
GSK_CONTAINER_NODE,
"GskContainerNode"
"GskContainerNode",
gsk_container_node_finalize
};
/**

View File

@ -67,6 +67,7 @@ struct _GskRenderNodeClass
{
GskRenderNodeType node_type;
const char *type_name;
void (* finalize) (GskRenderNode *node);
};
GskRenderNode *gsk_render_node_new (const GskRenderNodeClass *node_class);