[gthumb] crash when deleting duplicate
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] crash when deleting duplicate
- Date: Wed, 23 Dec 2015 19:04:32 +0000 (UTC)
commit 3cac9d32b2e5c2e77e3e23ee9373aaa352667c37
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed Dec 23 20:02:20 2015 +0100
crash when deleting duplicate
gth_file_source_vfs_remove: use a progress dialog if the parent
window is not a GthBrowser
[bug #759631]
gthumb/gth-browser.c | 1 +
gthumb/gth-file-source-vfs.c | 12 +++++++++++-
gthumb/gth-progress-dialog.c | 16 +++++++++++++++-
gthumb/gth-progress-dialog.h | 16 +++++++++-------
4 files changed, 36 insertions(+), 9 deletions(-)
---
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index af42353..e79ee99 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -5512,6 +5512,7 @@ gth_browser_exec_task (GthBrowser *browser,
GthTask *task,
GthTaskFlags flags)
{
+ g_return_if_fail (GTH_IS_BROWSER (browser));
g_return_if_fail (task != NULL);
if ((flags & GTH_TASK_FLAGS_FOREGROUND) == 0) {
diff --git a/gthumb/gth-file-source-vfs.c b/gthumb/gth-file-source-vfs.c
index 2ede8c9..c8c8998 100644
--- a/gthumb/gth-file-source-vfs.c
+++ b/gthumb/gth-file-source-vfs.c
@@ -31,6 +31,7 @@
#include "gth-file-source-vfs.h"
#include "gth-main.h"
#include "gth-preferences.h"
+#include "gth-progress-dialog.h"
#include "gth-trash-task.h"
#include "gtk-utils.h"
@@ -661,7 +662,16 @@ delete_file_permanently (GtkWindow *window,
files = gth_file_data_list_to_file_list (file_list);
task = gth_delete_task_new (files);
- gth_browser_exec_task (GTH_BROWSER (window), task, GTH_TASK_FLAGS_DEFAULT);
+ if (GTH_IS_BROWSER (window)) {
+ gth_browser_exec_task (GTH_BROWSER (window), task, GTH_TASK_FLAGS_DEFAULT);
+ }
+ else {
+ GtkWidget *dialog;
+
+ dialog = gth_progress_dialog_new (window);
+ gth_progress_dialog_destroy_with_tasks (GTH_PROGRESS_DIALOG (dialog), TRUE);
+ gth_progress_dialog_add_task (GTH_PROGRESS_DIALOG (dialog), task, GTH_TASK_FLAGS_DEFAULT);
+ }
g_object_unref (task);
_g_object_list_unref (files);
diff --git a/gthumb/gth-progress-dialog.c b/gthumb/gth-progress-dialog.c
index 1caa050..cd2fe4a 100644
--- a/gthumb/gth-progress-dialog.c
+++ b/gthumb/gth-progress-dialog.c
@@ -250,6 +250,7 @@ struct _GthProgressDialogPrivate {
GtkWidget *task_box;
gulong show_event;
gboolean custom_dialog_opened;
+ gboolean destroy_with_tasks;
};
@@ -294,6 +295,7 @@ gth_progress_dialog_init (GthProgressDialog *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_PROGRESS_DIALOG, GthProgressDialogPrivate);
self->priv->custom_dialog_opened = FALSE;
+ self->priv->destroy_with_tasks = FALSE;
gtk_widget_set_size_request (GTK_WIDGET (self), DIALOG_WIDTH, -1);
gtk_window_set_title (GTK_WINDOW (self), "");
@@ -325,6 +327,15 @@ gth_progress_dialog_new (GtkWindow *parent)
}
+void
+gth_progress_dialog_destroy_with_tasks (GthProgressDialog *self,
+ gboolean value)
+{
+ g_return_if_fail (GTH_IS_PROGRESS_DIALOG (self));
+ self->priv->destroy_with_tasks = value;
+}
+
+
static gboolean
_show_dialog_cb (gpointer data)
{
@@ -454,6 +465,9 @@ gth_progress_dialog_child_removed (GthProgressDialog *self)
g_source_remove (self->priv->show_event);
self->priv->show_event = 0;
}
- gtk_widget_hide (GTK_WIDGET (self));
+ if (self->priv->destroy_with_tasks)
+ gtk_widget_destroy (self);
+ else
+ gtk_widget_hide (GTK_WIDGET (self));
}
}
diff --git a/gthumb/gth-progress-dialog.h b/gthumb/gth-progress-dialog.h
index 50274a0..1f05914 100644
--- a/gthumb/gth-progress-dialog.h
+++ b/gthumb/gth-progress-dialog.h
@@ -47,13 +47,15 @@ struct _GthProgressDialogClass {
GtkDialogClass parent_class;
};
-GType gth_progress_dialog_get_type (void);
-GtkWidget * gth_progress_dialog_new (GtkWindow *parent);
-void gth_progress_dialog_add_task (GthProgressDialog *dialog,
- GthTask *task,
- GthTaskFlags flags);
-
-GtkWidget * gth_task_progress_new (GthTask *task);
+GType gth_progress_dialog_get_type (void);
+GtkWidget * gth_progress_dialog_new (GtkWindow *parent);
+void gth_progress_dialog_destroy_with_tasks (GthProgressDialog *dialog,
+ gboolean value);
+void gth_progress_dialog_add_task (GthProgressDialog *dialog,
+ GthTask *task,
+ GthTaskFlags flags);
+
+GtkWidget * gth_task_progress_new (GthTask *task);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]