[gtk+] Add an unrealize function to GtkLabel
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add an unrealize function to GtkLabel
- Date: Wed, 27 Dec 2017 04:35:03 +0000 (UTC)
commit 06ad134876fab771a9becb84cb176f7358bf34c5
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Dec 26 23:32:49 2017 -0500
Add an unrealize function to GtkLabel
We need to drpo the primary clipboard when the label
is getting unrealized while holding it. This fixes
a crash in the accessibility-dump test.
gtk/gtklabel.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 6dfb0f0..8dfd6bd 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -414,6 +414,7 @@ static gboolean gtk_label_focus (GtkWidget *widget,
GtkDirectionType direction);
static void gtk_label_realize (GtkWidget *widget);
+static void gtk_label_unrealize (GtkWidget *widget);
static void gtk_label_unmap (GtkWidget *widget);
static void gtk_label_motion (GtkEventControllerMotion *controller,
@@ -599,6 +600,7 @@ gtk_label_class_init (GtkLabelClass *class)
widget_class->query_tooltip = gtk_label_query_tooltip;
widget_class->snapshot = gtk_label_snapshot;
widget_class->realize = gtk_label_realize;
+ widget_class->unrealize = gtk_label_unrealize;
widget_class->unmap = gtk_label_unmap;
widget_class->hierarchy_changed = gtk_label_hierarchy_changed;
widget_class->display_changed = gtk_label_display_changed;
@@ -4148,6 +4150,21 @@ gtk_label_realize (GtkWidget *widget)
}
static void
+gtk_label_unrealize (GtkWidget *widget)
+{
+ GtkLabel *label = GTK_LABEL (widget);
+ GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
+ GdkClipboard *clipboard;
+
+ clipboard = gtk_widget_get_primary_clipboard (widget);
+ if (priv->select_info &&
+ gdk_clipboard_get_content (clipboard) == priv->select_info->provider)
+ gdk_clipboard_set_content (clipboard, NULL);
+
+ GTK_WIDGET_CLASS (gtk_label_parent_class)->unrealize (widget);
+}
+
+static void
gtk_label_unmap (GtkWidget *widget)
{
GtkLabel *label = GTK_LABEL (widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]