summaryrefslogtreecommitdiff
path: root/gtk/gtkplug.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-01-31 10:17:21 -0500
committerMatthias Clasen <mclasen@redhat.com>2011-01-31 10:17:21 -0500
commita26ffdc740beedddf36f64fcc09f435b22fe8aee (patch)
tree2c228b5abefc7d562a2b91351bace02aa2130ef9 /gtk/gtkplug.c
parent0208539c4bea013ee1e0e2297305a1f8b7c601f1 (diff)
downloadgtk+-a26ffdc740beedddf36f64fcc09f435b22fe8aee.tar.gz
Prevent a segfault in GtkPlug
The grabbed_keys might be NULL, so deal with that. https://bugzilla.gnome.org/show_bug.cgi?id=641023
Diffstat (limited to 'gtk/gtkplug.c')
-rw-r--r--gtk/gtkplug.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/gtk/gtkplug.c b/gtk/gtkplug.c
index b363d1d294..3a20b5d2e4 100644
--- a/gtk/gtkplug.c
+++ b/gtk/gtkplug.c
@@ -665,11 +665,8 @@ gtk_plug_finalize (GObject *object)
GtkPlugPrivate *priv = plug->priv;
if (priv->grabbed_keys)
- {
- g_hash_table_destroy (priv->grabbed_keys);
- priv->grabbed_keys = NULL;
- }
-
+ g_hash_table_destroy (priv->grabbed_keys);
+
G_OBJECT_CLASS (gtk_plug_parent_class)->finalize (object);
}
@@ -937,15 +934,17 @@ gtk_plug_filter_func (GdkXEvent *gdk_xevent,
break; /* FIXME: shouldn't this unref the plug? i.e. "goto done;" instead */
}
- g_hash_table_iter_init (&iter, priv->grabbed_keys);
-
- while (g_hash_table_iter_next (&iter, &key, NULL))
+ if (priv->grabbed_keys)
{
- GrabbedKey *grabbed_key = key;
-
- _gtk_xembed_send_message (priv->socket_window, XEMBED_GTK_GRAB_KEY, 0,
- grabbed_key->accelerator_key,
- grabbed_key->accelerator_mods);
+ g_hash_table_iter_init (&iter, priv->grabbed_keys);
+ while (g_hash_table_iter_next (&iter, &key, NULL))
+ {
+ GrabbedKey *grabbed_key = key;
+
+ _gtk_xembed_send_message (priv->socket_window, XEMBED_GTK_GRAB_KEY, 0,
+ grabbed_key->accelerator_key,
+ grabbed_key->accelerator_mods);
+ }
}
if (!was_embedded)
@@ -1344,7 +1343,7 @@ gtk_plug_keys_changed (GtkWindow *window)
if (old_grabbed_keys)
{
if (priv->socket_window)
- g_hash_table_foreach (old_grabbed_keys, remove_grabbed_key, plug);
+ g_hash_table_foreach (old_grabbed_keys, remove_grabbed_key, plug);
g_hash_table_destroy (old_grabbed_keys);
}
}