Commit a26ffdc7 authored by Matthias Clasen's avatar Matthias Clasen

Prevent a segfault in GtkPlug

The grabbed_keys might be NULL, so deal with that.
https://bugzilla.gnome.org/show_bug.cgi?id=641023
parent 0208539c
......@@ -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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment