[gnome-shell] Avoid warnings on null actors for tray icons
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Avoid warnings on null actors for tray icons
- Date: Mon, 25 Oct 2010 13:57:52 +0000 (UTC)
commit bc22109130c44799c9c4120ee737a17bd28684a3
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sun Oct 24 14:26:50 2010 +0200
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
src/shell-tray-manager.c | 22 +++++++++++++++-------
src/tray/na-tray-manager.c | 2 +-
2 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/shell-tray-manager.c b/src/shell-tray-manager.c
index ada5f4c..37368da 100644
--- a/src/shell-tray-manager.c
+++ b/src/shell-tray-manager.c
@@ -60,11 +60,13 @@ free_tray_icon (gpointer data)
{
ShellTrayManagerChild *child = data;
- gtk_widget_hide (child->window);
gtk_widget_destroy (child->window);
- g_signal_handlers_disconnect_matched (child->actor, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, child);
- g_object_unref (child->actor);
+ if (child->actor)
+ {
+ g_signal_handlers_disconnect_matched (child->actor, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, child);
+ g_object_unref (child->actor);
+ }
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);
g_return_if_fail (child != NULL);
- g_signal_emit (manager,
- shell_tray_manager_signals[TRAY_ICON_REMOVED], 0,
- child->actor);
+ 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,
+ shell_tray_manager_signals[TRAY_ICON_REMOVED], 0,
+ child->actor);
+ }
g_hash_table_remove (manager->priv->icons, socket);
}
diff --git a/src/tray/na-tray-manager.c b/src/tray/na-tray-manager.c
index 5a0b3bd..bccda63 100644
--- a/src/tray/na-tray-manager.c
+++ b/src/tray/na-tray-manager.c
@@ -300,8 +300,8 @@ na_tray_manager_handle_dock_request (NaTrayManager *manager,
if (!gtk_socket_get_plug_window (GTK_SOCKET (child)))
{
/* 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);
- gtk_widget_destroy (child);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]