diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-04-27 06:45:53 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-04-27 06:45:53 (GMT) |
commit | 9b915ec951f8f6350d3933886e1abeafe27d9802 (patch) | |
tree | 261a00c5e5430af6b65114484067b6d0aefb351d /src | |
parent | c01cd3cb3784cecf54727bb037defe0b4f671c78 (diff) |
Avoided freezes by refreshing the GUI in the main loop only.
Diffstat (limited to 'src')
-rw-r--r-- | src/analysis/db/items/move.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/analysis/db/items/move.c b/src/analysis/db/items/move.c index 20b9609..6cf1592 100644 --- a/src/analysis/db/items/move.c +++ b/src/analysis/db/items/move.c @@ -25,6 +25,7 @@ #include <assert.h> +#include <malloc.h> #include <stdio.h> #include <sys/socket.h> @@ -422,10 +423,53 @@ static bool g_db_move_run(const GDbMove *move, const vmpa2t *addr) { GtkViewPanel *vpanel; /* Afficheur effectif de code */ + typedef struct _move_params + { + GtkViewPanel *vpanel; /* Afficheur effectif de code */ + vmpa2t addr; /* Adresse de déplacement */ + + } move_params; + + move_params *params; /* Paramètres à transmettre */ + + /* Procédure de nettoyage */ + + void delete_move_params(move_params *p) + { + g_object_unref(G_OBJECT(p->vpanel)); + + free(p); + + } + + /* Procédure d'application différée */ + + gboolean do_move_in_main_loop(move_params *p) + { + gtk_view_panel_scroll_to_address(p->vpanel, &p->addr, SPT_CENTER); + + return G_SOURCE_REMOVE; + + } + + /* Lancement de l'opération */ + vpanel = g_editor_item_get_current_view(NULL); if (vpanel != NULL) - gtk_view_panel_scroll_to_address(vpanel, addr, SPT_CENTER); + { + params = (move_params *)calloc(1, sizeof(move_params)); + + params->vpanel = vpanel; + g_object_ref(G_OBJECT(vpanel)); + + copy_vmpa(¶ms->addr, addr); + + g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, + (GSourceFunc)do_move_in_main_loop, + params, (GDestroyNotify)delete_move_params); + + } return true; |