[gimp] libgimpwidgets: return TRUE in GimpColorProfileChooserDialog's "delete-event"



commit 467a663f16c5d32d3724601a1c14bcffed497a35
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jan 2 22:10:10 2018 +0100

    libgimpwidgets: return TRUE in GimpColorProfileChooserDialog's "delete-event"
    
    Otherwise the dialog is automatically destroyed when e.g. pressing
    Escape, which the code doesn't expect, leaving dangling (crashing)
    ponters around.

 libgimpwidgets/gimpcolorprofilechooserdialog.c |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/libgimpwidgets/gimpcolorprofilechooserdialog.c b/libgimpwidgets/gimpcolorprofilechooserdialog.c
index 5493049..5bedbbd 100644
--- a/libgimpwidgets/gimpcolorprofilechooserdialog.c
+++ b/libgimpwidgets/gimpcolorprofilechooserdialog.c
@@ -46,9 +46,13 @@ struct _GimpColorProfileChooserDialogPrivate
 };
 
 
-static void   gimp_color_profile_chooser_dialog_constructed    (GObject                       *object);
-static void   gimp_color_profile_chooser_dialog_add_shortcut   (GimpColorProfileChooserDialog *dialog);
-static void   gimp_color_profile_chooser_dialog_update_preview (GimpColorProfileChooserDialog *dialog);
+static void     gimp_color_profile_chooser_dialog_constructed    (GObject                       *object);
+
+static gboolean gimp_color_profile_chooser_dialog_delete_event   (GtkWidget                     *widget,
+                                                                  GdkEventAny                   *event);
+
+static void     gimp_color_profile_chooser_dialog_add_shortcut   (GimpColorProfileChooserDialog *dialog);
+static void     gimp_color_profile_chooser_dialog_update_preview (GimpColorProfileChooserDialog *dialog);
 
 
 G_DEFINE_TYPE (GimpColorProfileChooserDialog, gimp_color_profile_chooser_dialog,
@@ -60,9 +64,12 @@ G_DEFINE_TYPE (GimpColorProfileChooserDialog, gimp_color_profile_chooser_dialog,
 static void
 gimp_color_profile_chooser_dialog_class_init (GimpColorProfileChooserDialogClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GObjectClass   *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->constructed = gimp_color_profile_chooser_dialog_constructed;
+  object_class->constructed  = gimp_color_profile_chooser_dialog_constructed;
+
+  widget_class->delete_event = gimp_color_profile_chooser_dialog_delete_event;
 
   g_type_class_add_private (klass, sizeof (GimpColorProfileChooserDialogPrivate));
 }
@@ -127,6 +134,13 @@ gimp_color_profile_chooser_dialog_constructed (GObject *object)
                     NULL);
 }
 
+static gboolean
+gimp_color_profile_chooser_dialog_delete_event (GtkWidget   *widget,
+                                                GdkEventAny *event)
+{
+  return TRUE;
+}
+
 GtkWidget *
 gimp_color_profile_chooser_dialog_new (const gchar          *title,
                                        GtkWindow            *parent,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]