Avoid warnings on null actors for tray icons
Plugging the GtkSocket icon can fail, in which case NaTrayManager emits tray-icon-removed but the icon has never emitted plug-added, thus the ShellTrayIcon has not been created. This results in various criticals and exceptions in the tray-icon-removed handler. https://bugzilla.gnome.org/show_bug.cgi?id=633028
This commit is contained in:
parent
17055023db
commit
bc22109130
@ -60,11 +60,13 @@ free_tray_icon (gpointer data)
|
|||||||
{
|
{
|
||||||
ShellTrayManagerChild *child = data;
|
ShellTrayManagerChild *child = data;
|
||||||
|
|
||||||
gtk_widget_hide (child->window);
|
|
||||||
gtk_widget_destroy (child->window);
|
gtk_widget_destroy (child->window);
|
||||||
|
if (child->actor)
|
||||||
|
{
|
||||||
g_signal_handlers_disconnect_matched (child->actor, G_SIGNAL_MATCH_DATA,
|
g_signal_handlers_disconnect_matched (child->actor, G_SIGNAL_MATCH_DATA,
|
||||||
0, 0, NULL, NULL, child);
|
0, 0, NULL, NULL, child);
|
||||||
g_object_unref (child->actor);
|
g_object_unref (child->actor);
|
||||||
|
}
|
||||||
g_slice_free (ShellTrayManagerChild, child);
|
g_slice_free (ShellTrayManagerChild, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,8 +316,14 @@ na_tray_icon_removed (NaTrayManager *na_manager, GtkWidget *socket,
|
|||||||
child = g_hash_table_lookup (manager->priv->icons, socket);
|
child = g_hash_table_lookup (manager->priv->icons, socket);
|
||||||
g_return_if_fail (child != NULL);
|
g_return_if_fail (child != NULL);
|
||||||
|
|
||||||
|
if (child->actor != NULL)
|
||||||
|
{
|
||||||
|
/* Only emit signal if a corresponding tray-icon-added signal was emitted,
|
||||||
|
that is, if embedding did not fail and we got a plug-added
|
||||||
|
*/
|
||||||
g_signal_emit (manager,
|
g_signal_emit (manager,
|
||||||
shell_tray_manager_signals[TRAY_ICON_REMOVED], 0,
|
shell_tray_manager_signals[TRAY_ICON_REMOVED], 0,
|
||||||
child->actor);
|
child->actor);
|
||||||
|
}
|
||||||
g_hash_table_remove (manager->priv->icons, socket);
|
g_hash_table_remove (manager->priv->icons, socket);
|
||||||
}
|
}
|
||||||
|
@ -300,8 +300,8 @@ na_tray_manager_handle_dock_request (NaTrayManager *manager,
|
|||||||
if (!gtk_socket_get_plug_window (GTK_SOCKET (child)))
|
if (!gtk_socket_get_plug_window (GTK_SOCKET (child)))
|
||||||
{
|
{
|
||||||
/* Embedding failed, we won't get a plug-removed signal */
|
/* Embedding failed, we won't get a plug-removed signal */
|
||||||
|
/* This signal destroys the socket */
|
||||||
g_signal_emit (manager, manager_signals[TRAY_ICON_REMOVED], 0, child);
|
g_signal_emit (manager, manager_signals[TRAY_ICON_REMOVED], 0, child);
|
||||||
gtk_widget_destroy (child);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user