diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | src/analysis/project.c | 27 | ||||
-rw-r--r-- | src/analysis/project.h | 3 | ||||
-rw-r--r-- | src/glibext/signal.c | 13 | ||||
-rw-r--r-- | src/glibext/signal.h | 12 | ||||
-rw-r--r-- | src/gui/menus/project.c | 4 |
6 files changed, 40 insertions, 32 deletions
@@ -2,6 +2,19 @@ * src/analysis/project.c: * src/analysis/project.h: + Remove an useless function and update code. + + * src/glibext/signal.c: + * src/glibext/signal.h: + Handle swapping closures when signaling to the main thread. + + * src/gui/menus/project.c: + Update code. + +17-12-26 Cyrille Bagard <nocbos@gmail.com> + + * src/analysis/project.c: + * src/analysis/project.h: Clean the code for projects. * src/core/global.c: diff --git a/src/analysis/project.c b/src/analysis/project.c index 66f6b0f..cb1c70a 100644 --- a/src/analysis/project.c +++ b/src/analysis/project.c @@ -523,9 +523,9 @@ void ack_loaded_binary(GBinaryLoader *loader, GStudyProject *project) if (binary != NULL) { - g_signal_connect_to_main(binary, "disassembly-done", - G_CALLBACK(g_study_project_add_loaded_binary), project, - g_cclosure_marshal_VOID__VOID); + g_signal_connect_to_main_swapped(binary, "disassembly-done", + G_CALLBACK(g_study_project_attach_binary), project, + g_cclosure_marshal_VOID__VOID); g_loaded_binary_analyse(binary); @@ -536,27 +536,6 @@ void ack_loaded_binary(GBinaryLoader *loader, GStudyProject *project) /****************************************************************************** * * -* Paramètres : binary = élément binaire tout juste désassemblé. * -* project = projet dont le contenu est à compléter. * -* * -* Description : Assure l'intégration d'un élément binaire dans un projet. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void g_study_project_add_loaded_binary(GLoadedBinary *binary, GStudyProject *project) -{ - /* FIXME : remplacer cette fonction par un "swap" */ - g_study_project_attach_binary(project, binary); - -} - - -/****************************************************************************** -* * * Paramètres : widget = composant d'affichage nouvellement porté à l'écran. * * event = informations liées à l'événement. * * binary = fichier binaire à associer au projet actuel. * diff --git a/src/analysis/project.h b/src/analysis/project.h index b331b1f..8288384 100644 --- a/src/analysis/project.h +++ b/src/analysis/project.h @@ -99,9 +99,6 @@ GBinContent *g_study_project_find_binary_content_by_hash(GStudyProject *, const /* Acquitte la fin d'un chargement différé et complet. */ void ack_loaded_binary(GBinaryLoader *, GStudyProject *); -/* Assure l'intégration d'un élément binaire dans un projet. */ -void g_study_project_add_loaded_binary(GLoadedBinary *, GStudyProject *); - /* Attache un fichier donné à un projet donné. */ void g_study_project_attach_binary(GStudyProject *, GLoadedBinary *); diff --git a/src/glibext/signal.c b/src/glibext/signal.c index 654e696..e0a59c0 100644 --- a/src/glibext/signal.c +++ b/src/glibext/signal.c @@ -154,6 +154,8 @@ static void carry_signal_to_main_thread(gsignal_wrapper_info *info, ...) * signal = identification du signal à réceptionner. * * handler = fonction C servant de réceptacle. * * data = éventuelle donnée de l'utilisateur à ajouter. * +* marshal = précise la fonction de transfert des arguments. * +* flags = fournit quelques indications supplémentaires. * * * * Description : Reproduit le comportement de la fonction g_signal_connect(). * * * @@ -163,7 +165,7 @@ static void carry_signal_to_main_thread(gsignal_wrapper_info *info, ...) * * ******************************************************************************/ -gulong g_signal_connect_to_main(gpointer instance, const gchar *signal, GCallback handler, gpointer data, GClosureMarshal marshal) +gulong _g_signal_connect_to_main(gpointer instance, const gchar *signal, GCallback handler, gpointer data, GClosureMarshal marshal, GConnectFlags flags) { guint signal_id; /* Identifiant du signal visé */ GSignalQuery query; /* Information sur le signal */ @@ -181,7 +183,14 @@ gulong g_signal_connect_to_main(gpointer instance, const gchar *signal, GCallbac info->instance = instance; - info->closure = g_cclosure_new(handler, data, NULL); + if (flags & G_CONNECT_SWAPPED) + info->closure = g_cclosure_new_swap(handler, data, NULL); + else + info->closure = g_cclosure_new(handler, data, NULL); + + g_closure_ref(info->closure); + g_closure_sink(info->closure); + g_closure_set_marshal(info->closure, marshal); info->return_type = query.return_type; diff --git a/src/glibext/signal.h b/src/glibext/signal.h index 0c8e8a0..ba12a7b 100644 --- a/src/glibext/signal.h +++ b/src/glibext/signal.h @@ -27,11 +27,21 @@ #include <glib-object.h> #include <gobject/gclosure.h> +#include <glib/gdataset.h> +#include <glib/glist.h> +#include <gobject/gsignal.h> /* Reproduit le comportement de la fonction g_signal_connect(). */ -gulong g_signal_connect_to_main(gpointer, const gchar *, GCallback, gpointer, GClosureMarshal); +gulong _g_signal_connect_to_main(gpointer, const gchar *, GCallback, gpointer, GClosureMarshal, GConnectFlags); + + +#define g_signal_connect_to_main(instance, signal, handler, data, marshal) \ + _g_signal_connect_to_main(instance, signal, handler, data, marshal, 0) + +#define g_signal_connect_to_main_swapped(instance, signal, handler, data, marshal) \ + _g_signal_connect_to_main(instance, signal, handler, data, marshal, G_CONNECT_SWAPPED) diff --git a/src/gui/menus/project.c b/src/gui/menus/project.c index 2930a95..c46c017 100644 --- a/src/gui/menus/project.c +++ b/src/gui/menus/project.c @@ -228,8 +228,8 @@ static void mcb_project_add_shellcode(GtkMenuItem *menuitem, GMenuBar *bar) if (binary != NULL) { - g_signal_connect(binary, "disassembly-done", - G_CALLBACK(g_study_project_add_loaded_binary), get_current_project()); + g_signal_connect_swapped(binary, "disassembly-done", + G_CALLBACK(g_study_project_attach_binary), get_current_project()); g_loaded_binary_analyse(binary); } |