summaryrefslogtreecommitdiff
path: root/src/arch/instruction.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/instruction.c')
-rw-r--r--src/arch/instruction.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index dd5b019..8f2f262 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -191,6 +191,26 @@ static void g_arch_instruction_generator_interface_init(GLineGeneratorInterface
static void g_arch_instruction_dispose(GArchInstruction *instr)
{
+ size_t count; /* Nombre d'opérandes en place */
+ size_t i; /* Boucle de parcours */
+ GArchOperand *op; /* Opérande à manipuler */
+
+ g_arch_instruction_lock_operands(instr);
+
+ count = _g_arch_instruction_count_operands(instr);
+
+ for (i = 0; i < count; i++)
+ {
+ op = _g_arch_instruction_get_operand(instr, 0);
+
+ rem_item_from_flat_array(&instr->operands, 0, sizeof(GArchOperand *));
+
+ g_shared_instance_unref(G_SHARED_INSTANCE(op));
+
+ }
+
+ g_arch_instruction_unlock_operands(instr);
+
G_OBJECT_CLASS(g_arch_instruction_parent_class)->dispose(G_OBJECT(instr));
}
@@ -619,7 +639,7 @@ bool _g_arch_instruction_replace_operand(GArchInstruction *instr, GArchOperand *
{
rpl_item_in_flat_array(instr->operands, i, &new, sizeof(GArchOperand *));
- //g_object_unref(G_OBJECT(old));
+ g_shared_instance_unref(G_SHARED_INSTANCE(old));
}
@@ -660,7 +680,7 @@ void _g_arch_instruction_detach_operand(GArchInstruction *instr, GArchOperand *t
rem_item_from_flat_array(&instr->operands, i, sizeof(GArchOperand *));
- g_object_unref(G_OBJECT(target));
+ g_shared_instance_unref(G_SHARED_INSTANCE(target));
}