diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/editor.c | 8 | ||||
-rw-r--r-- | src/gui/menus/file.c | 6 | ||||
-rw-r--r-- | src/gui/menus/project.c | 11 |
3 files changed, 16 insertions, 9 deletions
diff --git a/src/gui/editor.c b/src/gui/editor.c index d1f90d5..11c7f06 100644 --- a/src/gui/editor.c +++ b/src/gui/editor.c @@ -421,7 +421,6 @@ static gboolean on_delete_editor(GtkWidget *widget, GdkEvent *event, gpointer da result = FALSE; project = get_current_project(); - if (project == NULL) goto ode_no_project; if (g_study_project_get_filename(project) == NULL) { @@ -454,7 +453,7 @@ static gboolean on_delete_editor(GtkWidget *widget, GdkEvent *event, gpointer da } - ode_no_project: + g_object_unref(G_OBJECT(project)); return result; @@ -476,11 +475,6 @@ static gboolean on_delete_editor(GtkWidget *widget, GdkEvent *event, gpointer da static void on_destroy_editor(GtkWidget *widget, GObject *ref) { - GStudyProject *project; /* Projet courant */ - - project = get_current_project(); - if (project != NULL) g_object_unref(G_OBJECT(project)); - /* Fermeture propre */ /* ... */ diff --git a/src/gui/menus/file.c b/src/gui/menus/file.c index c0c031c..9c0b218 100644 --- a/src/gui/menus/file.c +++ b/src/gui/menus/file.c @@ -185,6 +185,8 @@ static void mcb_file_open_project(GtkMenuItem *menuitem, gpointer unused) gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), g_study_project_get_filename(project)); + g_object_unref(G_OBJECT(project)); + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); @@ -235,6 +237,8 @@ static void mcb_file_save_project(GtkMenuItem *menuitem, gpointer unused) else mcb_file_save_project_as(menuitem, NULL); + g_object_unref(G_OBJECT(project)); + } @@ -280,6 +284,8 @@ static void mcb_file_save_project_as(GtkMenuItem *menuitem, gpointer unused) } + g_object_unref(G_OBJECT(project)); + gtk_widget_destroy(dialog); } diff --git a/src/gui/menus/project.c b/src/gui/menus/project.c index 5d027a0..424a506 100644 --- a/src/gui/menus/project.c +++ b/src/gui/menus/project.c @@ -202,6 +202,8 @@ static void mcb_project_add_shellcode(GtkMenuItem *menuitem, GMenuBar *bar) } + g_object_unref(G_OBJECT(project)); + #if 0 GtkWidget *dialog; /* Boîte à afficher */ char *dir; /* Répertoire courant */ @@ -262,6 +264,7 @@ static void mcb_project_add_shellcode(GtkMenuItem *menuitem, GMenuBar *bar) static void mcb_project_add_binary_file(GtkMenuItem *menuitem, GMenuBar *bar) { GtkWidget *dialog; /* Boîte à afficher */ + GStudyProject *project; /* Projet courant */ char *dir; /* Répertoire courant */ gchar *filename; /* Nom du fichier à intégrer */ GBinContent *content; /* Contenu binaire à charger */ @@ -273,14 +276,18 @@ static void mcb_project_add_binary_file(GtkMenuItem *menuitem, GMenuBar *bar) _("_Open"), GTK_RESPONSE_ACCEPT, NULL); - if (g_study_project_get_filename(get_current_project()) != NULL) + project = get_current_project(); + + if (g_study_project_get_filename(project) != NULL) { - dir = strdup(g_study_project_get_filename(get_current_project())); + dir = strdup(g_study_project_get_filename(project)); dir = dirname(dir); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), dir); free(dir); } + g_object_unref(G_OBJECT(project)); + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); |