[Xfce4-commits] [xfce/xfce4-panel] 01/01: actions: Fix GPtrArray usage (Bug #13981)

noreply at xfce.org noreply at xfce.org
Sun Nov 12 00:12:02 CET 2017


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-panel.

commit 7b6f620942f95ce636184006eebd8486c8b690ed
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Sun Nov 12 00:11:48 2017 +0100

    actions: Fix GPtrArray usage (Bug #13981)
    
    This is a fix analogous to the ones for launcher and systray in
    commit fd4b03b165ba6e3110014216dc77468401237e4c
---
 plugins/actions/actions.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/plugins/actions/actions.c b/plugins/actions/actions.c
index 20bfc32..8e25353 100644
--- a/plugins/actions/actions.c
+++ b/plugins/actions/actions.c
@@ -283,6 +283,17 @@ actions_plugin_init (ActionsPlugin *plugin)
 
 
 static void
+actions_plugin_free_array_element (gpointer data)
+{
+  GValue *value = (GValue *)data;
+
+  g_value_unset (value);
+  g_free (value);
+}
+
+
+
+static void
 actions_plugin_get_property (GObject    *object,
                              guint       prop_id,
                              GValue     *value,
@@ -327,8 +338,9 @@ actions_plugin_set_property (GObject      *object,
   switch (prop_id)
     {
     case PROP_ITEMS:
-      if (plugin->items != NULL)
-        xfconf_array_free (plugin->items);
+      if (plugin->items != NULL) {
+        g_ptr_array_unref (plugin->items);
+      }
       plugin->items = g_value_dup_boxed (value);
       actions_plugin_pack (plugin);
       break;
@@ -394,7 +406,7 @@ actions_plugin_free_data (XfcePanelPlugin *panel_plugin)
     g_source_remove (plugin->pack_idle_id);
 
   if (plugin->items != NULL)
-    xfconf_array_free (plugin->items);
+    g_ptr_array_unref (plugin->items);
 
   if (plugin->menu != NULL)
     gtk_widget_destroy (plugin->menu);
@@ -454,7 +466,7 @@ actions_plugin_configure_store (gpointer data)
   model = g_object_get_data (G_OBJECT (plugin), "items-store");
   panel_return_val_if_fail (GTK_IS_LIST_STORE (model), FALSE);
 
-  array = g_ptr_array_new ();
+  array = g_ptr_array_new_full (1, (GDestroyNotify) actions_plugin_free_array_element);
 
   if (gtk_tree_model_get_iter_first (model, &iter))
     {
@@ -479,7 +491,7 @@ actions_plugin_configure_store (gpointer data)
 
   /* Store the new array */
   if (plugin->items != NULL)
-    xfconf_array_free (plugin->items);
+    g_ptr_array_unref (plugin->items);
   plugin->items = array;
   g_object_notify (G_OBJECT (plugin), "items");
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list