[Xfce4-commits] <xfce4-panel:master> Improve thread-safety.

Nick Schermer noreply at xfce.org
Sat May 28 18:12:01 CEST 2011


Updating branch refs/heads/master
         to d208ced73d6e839e4ac4c9321ae53c3c2ffa7e8f (commit)
       from 176a68b8f347f84e4dc8fdf7f8e81d1e8e6034b0 (commit)

commit d208ced73d6e839e4ac4c9321ae53c3c2ffa7e8f
Author: Nick Schermer <nick at xfce.org>
Date:   Sat May 28 18:10:06 2011 +0200

    Improve thread-safety.

 libxfce4panel/xfce-arrow-button.c  |    4 ++++
 panel/panel-base-window.c          |    2 ++
 plugins/clock/clock.c              |    2 ++
 plugins/launcher/launcher-dialog.c |    4 ++++
 plugins/pager/pager-buttons.c      |    8 +++++++-
 plugins/systray/systray.c          |    4 ++++
 plugins/tasklist/tasklist-widget.c |    8 ++++++++
 7 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/libxfce4panel/xfce-arrow-button.c b/libxfce4panel/xfce-arrow-button.c
index 615a9d3..be33780 100644
--- a/libxfce4panel/xfce-arrow-button.c
+++ b/libxfce4panel/xfce-arrow-button.c
@@ -381,6 +381,8 @@ xfce_arrow_button_blinking_timeout (gpointer user_data)
   GtkStyle        *style;
   GtkRcStyle      *rc;
 
+  GDK_THREADS_ENTER ();
+
   rc = gtk_widget_get_modifier_style (GTK_WIDGET (button));
   if(PANEL_HAS_FLAG (rc->color_flags[GTK_STATE_NORMAL], GTK_RC_BG)
      || button->priv->blinking_timeout_id == 0)
@@ -398,6 +400,8 @@ xfce_arrow_button_blinking_timeout (gpointer user_data)
       gtk_widget_modify_style(GTK_WIDGET (button), rc);
     }
 
+  GDK_THREADS_LEAVE ();
+
   return (button->priv->blinking_counter++ < MAX_BLINKING_COUNT);
 }
 
diff --git a/panel/panel-base-window.c b/panel/panel-base-window.c
index 23ecd55..6064aee 100644
--- a/panel/panel-base-window.c
+++ b/panel/panel-base-window.c
@@ -714,7 +714,9 @@ static gboolean
 panel_base_window_active_timeout (gpointer user_data)
 {
   /* redraw to update marching ants */
+  GDK_THREADS_ENTER ();
   gtk_widget_queue_draw (GTK_WIDGET (user_data));
+  GDK_THREADS_LEAVE ();
 
   return TRUE;
 }
diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c
index 25435e0..77a1d1c 100644
--- a/plugins/clock/clock.c
+++ b/plugins/clock/clock.c
@@ -893,7 +893,9 @@ clock_plugin_timeout_running (gpointer user_data)
   gboolean            result;
   struct tm           tm;
 
+  GDK_THREADS_ENTER ();
   result = (timeout->function) (timeout->data);
+  GDK_THREADS_LEAVE ();
 
   /* check if the timeout still runs in time if updating once a minute */
   if (result && timeout->interval == CLOCK_INTERVAL_MINUTE)
diff --git a/plugins/launcher/launcher-dialog.c b/plugins/launcher/launcher-dialog.c
index 4a87222..bc6853d 100644
--- a/plugins/launcher/launcher-dialog.c
+++ b/plugins/launcher/launcher-dialog.c
@@ -471,6 +471,8 @@ launcher_dialog_tree_save (LauncherPluginDialog *dialog)
   GObject   *store;
   GPtrArray *array;
 
+  GDK_THREADS_ENTER ();
+
   store = gtk_builder_get_object (dialog->builder, "item-store");
 
   array = g_ptr_array_new ();
@@ -484,6 +486,8 @@ launcher_dialog_tree_save (LauncherPluginDialog *dialog)
           G_CALLBACK (launcher_dialog_items_load), dialog);
 
   xfconf_array_free (array);
+
+  GDK_THREADS_LEAVE ();
 }
 
 
diff --git a/plugins/pager/pager-buttons.c b/plugins/pager/pager-buttons.c
index 7436bb3..b0a07fa 100644
--- a/plugins/pager/pager-buttons.c
+++ b/plugins/pager/pager-buttons.c
@@ -294,6 +294,8 @@ pager_buttons_rebuild_idle (gpointer user_data)
   panel_return_val_if_fail (XFCE_IS_PAGER_BUTTONS (pager), FALSE);
   panel_return_val_if_fail (WNCK_IS_SCREEN (pager->wnck_screen), FALSE);
 
+  GDK_THREADS_ENTER ();
+
   gtk_container_foreach (GTK_CONTAINER (pager),
       (GtkCallback) gtk_widget_destroy, NULL);
 
@@ -303,7 +305,7 @@ pager_buttons_rebuild_idle (gpointer user_data)
   active_ws = wnck_screen_get_active_workspace (pager->wnck_screen);
   workspaces = wnck_screen_get_workspaces (pager->wnck_screen);
   if (workspaces == NULL)
-    return FALSE;
+    goto leave;
 
   n_workspaces = g_list_length (workspaces);
 
@@ -438,6 +440,10 @@ pager_buttons_rebuild_idle (gpointer user_data)
 
   pager->buttons = g_slist_reverse (pager->buttons);
 
+  leave:
+
+  GDK_THREADS_LEAVE ();
+
   return FALSE;
 }
 
diff --git a/plugins/systray/systray.c b/plugins/systray/systray.c
index 4a2d23c..35e8808 100644
--- a/plugins/systray/systray.c
+++ b/plugins/systray/systray.c
@@ -360,6 +360,8 @@ systray_plugin_screen_changed_idle (gpointer user_data)
   GdkScreen     *screen;
   GError        *error = NULL;
 
+  GDK_THREADS_ENTER ();
+
   /* create a new manager and register this screen */
   plugin->manager = systray_manager_new ();
   g_signal_connect (G_OBJECT (plugin->manager), "icon-added",
@@ -383,6 +385,8 @@ systray_plugin_screen_changed_idle (gpointer user_data)
       g_error_free (error);
     }
 
+  GDK_THREADS_LEAVE ();
+
   return FALSE;
 }
 
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 6ca82e6..9bae441 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -1839,6 +1839,8 @@ xfce_tasklist_update_monitor_geometry_idle (gpointer data)
 
   panel_return_val_if_fail (XFCE_IS_TASKLIST (tasklist), FALSE);
 
+  GDK_THREADS_ENTER ();
+
   if (!tasklist->all_monitors)
     {
       screen = gtk_widget_get_screen (GTK_WIDGET (tasklist));
@@ -1867,6 +1869,8 @@ xfce_tasklist_update_monitor_geometry_idle (gpointer data)
     xfce_tasklist_active_workspace_changed (tasklist->screen,
                                             NULL, tasklist);
 
+  GDK_THREADS_LEAVE ();
+
   return FALSE;
 }
 
@@ -1888,6 +1892,8 @@ xfce_tasklist_child_drag_motion_timeout (gpointer data)
   panel_return_val_if_fail (XFCE_IS_TASKLIST (child->tasklist), FALSE);
   panel_return_val_if_fail (WNCK_IS_SCREEN (child->tasklist->screen), FALSE);
 
+  GDK_THREADS_ENTER ();
+
   if (child->type == CHILD_TYPE_WINDOW)
     {
       xfce_tasklist_button_activate (child, child->motion_timestamp);
@@ -1897,6 +1903,8 @@ xfce_tasklist_child_drag_motion_timeout (gpointer data)
        /* TODO popup menu */
     }
 
+  GDK_THREADS_LEAVE ();
+
   return FALSE;
 }
 



More information about the Xfce4-commits mailing list