mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-09-12 21:36:14 +02:00
girepository/parser: Clarify ownership of nodetype nodes
We may had free'd a list of items without freeing the items in there. So now, properly steal the data instead and free everything.
This commit is contained in:
parent
bfb62e9095
commit
7c9a604eb2
@ -2248,7 +2248,7 @@ end_type_top (ParseContext *ctx)
|
||||
if (!ctx->type_parameters)
|
||||
goto out;
|
||||
|
||||
typenode = (GIIrNodeType*)ctx->type_parameters->data;
|
||||
typenode = (GIIrNodeType*) g_steal_pointer (&ctx->type_parameters->data);
|
||||
|
||||
/* Default to pointer for unspecified containers */
|
||||
if (typenode->tag == GI_TYPE_TAG_ARRAY ||
|
||||
@ -2297,7 +2297,7 @@ end_type_top (ParseContext *ctx)
|
||||
g_printerr("current node is %d\n", CURRENT_NODE (ctx)->type);
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
g_list_free (ctx->type_parameters);
|
||||
g_list_free_full (ctx->type_parameters, (GDestroyNotify) gi_ir_node_free);
|
||||
|
||||
out:
|
||||
ctx->type_depth = 0;
|
||||
@ -2313,7 +2313,7 @@ end_type_recurse (ParseContext *ctx)
|
||||
|
||||
parent = (GIIrNodeType *) ((GList*)ctx->type_stack->data)->data;
|
||||
if (ctx->type_parameters)
|
||||
param = (GIIrNodeType *) ctx->type_parameters->data;
|
||||
param = (GIIrNodeType *) g_steal_pointer (&ctx->type_parameters->data);
|
||||
|
||||
if (parent->tag == GI_TYPE_TAG_ARRAY ||
|
||||
parent->tag == GI_TYPE_TAG_GLIST ||
|
||||
@ -2322,7 +2322,7 @@ end_type_recurse (ParseContext *ctx)
|
||||
g_assert (param != NULL);
|
||||
|
||||
if (parent->parameter_type1 == NULL)
|
||||
parent->parameter_type1 = param;
|
||||
parent->parameter_type1 = g_steal_pointer (¶m);
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
@ -2331,13 +2331,14 @@ end_type_recurse (ParseContext *ctx)
|
||||
g_assert (param != NULL);
|
||||
|
||||
if (parent->parameter_type1 == NULL)
|
||||
parent->parameter_type1 = param;
|
||||
parent->parameter_type1 = g_steal_pointer (¶m);
|
||||
else if (parent->parameter_type2 == NULL)
|
||||
parent->parameter_type2 = param;
|
||||
parent->parameter_type2 = g_steal_pointer (¶m);
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
g_list_free (ctx->type_parameters);
|
||||
g_clear_pointer ((GIIrNode **) ¶m, gi_ir_node_free);
|
||||
g_list_free_full (ctx->type_parameters, (GDestroyNotify) gi_ir_node_free);
|
||||
ctx->type_parameters = (GList *)ctx->type_stack->data;
|
||||
ctx->type_stack = g_list_delete_link (ctx->type_stack, ctx->type_stack);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user