diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-12-15 13:40:28 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-12-15 13:40:28 (GMT) |
commit | 124c8410dbfcad59d66b850c50c96ec73a607ab7 (patch) | |
tree | b7127c66abfccd11b9126741e2809a893ee44143 /src/gui/menus | |
parent | db1a6171007a6641a4659392c9bcc05670396643 (diff) |
Defined proper accesses to instructions loaded by a processor.
Diffstat (limited to 'src/gui/menus')
-rw-r--r-- | src/gui/menus/edition.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c index 95b4f50..da2c60f 100644 --- a/src/gui/menus/edition.c +++ b/src/gui/menus/edition.c @@ -384,6 +384,8 @@ static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, GMenuBar * switcher = g_db_switcher_new(instr, G_IMM_OPERAND(creator), display); + g_object_unref(G_OBJECT(instr)); + g_loaded_binary_add_to_collection(binary, G_DB_ITEM(switcher)); g_object_unref(G_OBJECT(proc)); @@ -492,7 +494,6 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) const mrange_t *range; /* Couverture en mémoire */ GLoadedBinary *binary; /* Représentation binaire */ GArchProcessor *proc; /* Processeur de l'architecture*/ - GArchInstruction *list; /* Ensemble des instructions */ GArchInstruction *instr; /* Point de croisements */ GObject *ref; /* Espace de référencements */ GtkWidget *dialog; /* Boîte de dialogue à montrer */ @@ -506,7 +507,6 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) binary = g_editor_item_get_current_binary(G_EDITOR_ITEM(bar)); proc = g_loaded_binary_get_processor(binary); - list = g_arch_processor_get_disassembled_instructions(proc); /** * On ne peut pas se reposer sur l'espace couvert par une ligne, car il peut @@ -518,9 +518,9 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) * * instr = g_arch_instruction_find_by_range(list, range); * - * Il faut ainsi être plus souple. + * Il faut ainsi être plus souple, et se baser sur l'adresse uniquement. */ - instr = g_arch_instruction_find_by_address(list, get_mrange_addr(range), true); + instr = g_arch_processor_find_instr_by_address(proc, get_mrange_addr(range)); ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar)); @@ -538,6 +538,9 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) gtk_widget_destroy(dialog); + if (instr != NULL) + g_object_unref(G_OBJECT(instr)); + g_object_unref(G_OBJECT(proc)); g_object_unref(G_OBJECT(line)); |