gimp r27354 - in trunk: . app/widgets
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27354 - in trunk: . app/widgets
- Date: Tue, 21 Oct 2008 19:23:44 +0000 (UTC)
Author: mitch
Date: Tue Oct 21 19:23:44 2008
New Revision: 27354
URL: http://svn.gnome.org/viewvc/gimp?rev=27354&view=rev
Log:
2008-10-21 Michael Natterer <mitch gimp org>
* app/widgets/gimpfiledialog.c: set dialog->progress to NULL in
destroy() and check for progress being NULL in various places so
we don't crash on API calls after the widget is destroyed.
Modified:
trunk/ChangeLog
trunk/app/widgets/gimpfiledialog.c
Modified: trunk/app/widgets/gimpfiledialog.c
==============================================================================
--- trunk/app/widgets/gimpfiledialog.c (original)
+++ trunk/app/widgets/gimpfiledialog.c Tue Oct 21 19:23:44 2008
@@ -63,6 +63,8 @@
static void gimp_file_dialog_progress_iface_init (GimpProgressInterface *iface);
+
+static void gimp_file_dialog_destroy (GtkObject *object);
static gboolean gimp_file_dialog_delete_event (GtkWidget *widget,
GdkEventAny *event);
static void gimp_file_dialog_response (GtkDialog *dialog,
@@ -122,9 +124,12 @@
static void
gimp_file_dialog_class_init (GimpFileDialogClass *klass)
{
+ GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass);
+ object_class->destroy = gimp_file_dialog_destroy;
+
widget_class->delete_event = gimp_file_dialog_delete_event;
dialog_class->response = gimp_file_dialog_response;
@@ -148,6 +153,16 @@
iface->get_window = gimp_file_dialog_progress_get_window;
}
+static void
+gimp_file_dialog_destroy (GtkObject *object)
+{
+ GimpFileDialog *dialog = GIMP_FILE_DIALOG (object);
+
+ GTK_OBJECT_CLASS (parent_class)->destroy (object);
+
+ dialog->progress = NULL;
+}
+
static gboolean
gimp_file_dialog_delete_event (GtkWidget *widget,
GdkEventAny *event)
@@ -165,7 +180,8 @@
{
file_dialog->canceled = TRUE;
- if (GIMP_PROGRESS_BOX (file_dialog->progress)->active &&
+ if (file_dialog->progress &&
+ GIMP_PROGRESS_BOX (file_dialog->progress)->active &&
GIMP_PROGRESS_BOX (file_dialog->progress)->cancelable)
{
gimp_progress_cancel (GIMP_PROGRESS (dialog));
@@ -179,14 +195,17 @@
gboolean cancelable)
{
GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
- GimpProgress *retval;
+ GimpProgress *retval = NULL;
- retval = gimp_progress_start (GIMP_PROGRESS (dialog->progress),
- message, cancelable);
- gtk_widget_show (dialog->progress);
+ if (dialog->progress)
+ {
+ retval = gimp_progress_start (GIMP_PROGRESS (dialog->progress),
+ message, cancelable);
+ gtk_widget_show (dialog->progress);
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
- GTK_RESPONSE_CANCEL, cancelable);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ GTK_RESPONSE_CANCEL, cancelable);
+ }
return retval;
}
@@ -196,8 +215,11 @@
{
GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
- gimp_progress_end (GIMP_PROGRESS (dialog->progress));
- gtk_widget_hide (dialog->progress);
+ if (dialog->progress)
+ {
+ gimp_progress_end (GIMP_PROGRESS (dialog->progress));
+ gtk_widget_hide (dialog->progress);
+ }
}
static gboolean
@@ -205,7 +227,10 @@
{
GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
- return gimp_progress_is_active (GIMP_PROGRESS (dialog->progress));
+ if (dialog->progress)
+ return gimp_progress_is_active (GIMP_PROGRESS (dialog->progress));
+
+ return FALSE;
}
static void
@@ -214,7 +239,8 @@
{
GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
- gimp_progress_set_text (GIMP_PROGRESS (dialog->progress), message);
+ if (dialog->progress)
+ gimp_progress_set_text (GIMP_PROGRESS (dialog->progress), message);
}
static void
@@ -223,7 +249,8 @@
{
GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
- gimp_progress_set_value (GIMP_PROGRESS (dialog->progress), percentage);
+ if (dialog->progress)
+ gimp_progress_set_value (GIMP_PROGRESS (dialog->progress), percentage);
}
static gdouble
@@ -231,7 +258,10 @@
{
GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
- return gimp_progress_get_value (GIMP_PROGRESS (dialog->progress));
+ if (dialog->progress)
+ return gimp_progress_get_value (GIMP_PROGRESS (dialog->progress));
+
+ return 0.0;
}
static void
@@ -239,7 +269,8 @@
{
GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress);
- gimp_progress_pulse (GIMP_PROGRESS (dialog->progress));
+ if (dialog->progress)
+ gimp_progress_pulse (GIMP_PROGRESS (dialog->progress));
}
static guint32
@@ -369,6 +400,10 @@
g_return_if_fail (GIMP_IS_FILE_DIALOG (dialog));
+ /* bail out if we are already destroyed */
+ if (! dialog->progress)
+ return;
+
children =
gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]