[gtk+/wip/dboles/combobox-cleanup: 2/4] combobox: popdown() the menu popup_widget on unmap
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/dboles/combobox-cleanup: 2/4] combobox: popdown() the menu popup_widget on unmap
- Date: Fri, 20 Jan 2017 04:06:44 +0000 (UTC)
commit 1e2afb79428d03d42c3cd9e143e476ac04582218
Author: Daniel Boles <dboles src gnome org>
Date: Fri Jan 20 03:30:36 2017 +0000
combobox: popdown() the menu popup_widget on unmap
The end-of-life popdown() was called in destroy(), after dispose() had
already called menu_destroy(), which leads to our detacher NULLing out
the pointer, so Menu::popdown() was always skipped. A far better place
to call popdown() – and have it actually work! – is in unmap(). Do so.
gtk/gtkcombobox.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index abcdc1a..d6bc2c9 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -228,6 +228,7 @@ static void gtk_combo_box_cell_editable_init (GtkCellEditableIface *iface)
static void gtk_combo_box_constructed (GObject *object);
static void gtk_combo_box_dispose (GObject *object);
static void gtk_combo_box_finalize (GObject *object);
+static void gtk_combo_box_unmap (GtkWidget *widget);
static void gtk_combo_box_destroy (GtkWidget *widget);
static void gtk_combo_box_set_property (GObject *object,
@@ -525,6 +526,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
widget_class->mnemonic_activate = gtk_combo_box_mnemonic_activate;
widget_class->grab_focus = gtk_combo_box_grab_focus;
widget_class->measure = gtk_combo_box_measure_;
+ widget_class->unmap = gtk_combo_box_unmap;
widget_class->destroy = gtk_combo_box_destroy;
widget_class->compute_expand = gtk_combo_box_compute_expand;
@@ -2968,6 +2970,15 @@ gtk_combo_box_grab_focus (GtkWidget *widget)
gtk_widget_grab_focus (combo_box->priv->button);
}
+static void gtk_combo_box_unmap (GtkWidget *widget)
+{
+ GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
+
+ gtk_menu_popdown (GTK_MENU (combo_box->priv->popup_widget));
+
+ GTK_WIDGET_CLASS (gtk_combo_box_parent_class)->unmap (widget);
+}
+
static void
gtk_combo_box_destroy (GtkWidget *widget)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]