[Xfce4-commits] [panel-plugins/xfce4-sensors-plugin] 11/11: unref correct css provider and set to null after unreferencing for increased reliability and perhaps to also fix down memory corruption bugs

noreply at xfce.org noreply at xfce.org
Tue Mar 7 23:38:35 CET 2017


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

timystery pushed a commit to branch master
in repository panel-plugins/xfce4-sensors-plugin.

commit 57f7827e0c4b78c215b9fafee39cdbf7ec42619c
Author: Fabian <timystery at arcor.de>
Date:   Tue Mar 7 23:37:25 2017 +0100

    unref correct css provider and set to null after unreferencing for increased reliability and perhaps to also fix down memory corruption bugs
---
 panel-plugin/sensors-plugin.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/panel-plugin/sensors-plugin.c b/panel-plugin/sensors-plugin.c
index d8a8c4b..ddc1606 100644
--- a/panel-plugin/sensors-plugin.c
+++ b/panel-plugin/sensors-plugin.c
@@ -215,6 +215,7 @@ sensors_remove_graphical_panel (t_sensors *ptr_sensorsstructure)
                 ptr_labelledlevelbar = ptr_sensorsstructure->panels[idx_sensorchips][idx_feature];
 
                 g_object_unref (ptr_labelledlevelbar->css_provider);
+                ptr_labelledlevelbar->css_provider = NULL;
 
                 if (ptr_sensorsstructure->show_labels == TRUE) {
                     gtk_widget_hide (ptr_labelledlevelbar->label);
@@ -365,7 +366,6 @@ sensors_add_graphical_display (t_sensors *sensors)
     gchar *str_barlabeltext, *str_panellabeltext;
     guint len_barlabeltext;
     gint size_panel = (gint) sensors->panel_size;
-    GtkCssProvider *ptr_gtkcssprovider;
     GdkDisplay *ptr_gdkdisplay;
     GdkScreen *ptr_gdkscreen;
 
@@ -415,12 +415,12 @@ sensors_add_graphical_display (t_sensors *sensors)
                 ptr_labelledlevelbar = g_new (t_labelledlevelbar, 1);
                 ptr_labelledlevelbar->progressbar = widget_progbar;
 
-                ptr_labelledlevelbar->css_provider = ptr_gtkcssprovider = gtk_css_provider_new ();
+                ptr_labelledlevelbar->css_provider = gtk_css_provider_new ();
                 ptr_gdkdisplay = gdk_display_get_default ();
                 ptr_gdkscreen = gdk_display_get_default_screen (ptr_gdkdisplay);
 
                 gtk_style_context_add_provider_for_screen (ptr_gdkscreen,
-                                 GTK_STYLE_PROVIDER (ptr_gtkcssprovider),
+                                 GTK_STYLE_PROVIDER (ptr_labelledlevelbar->css_provider),
                                  GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 
                 /* create the label stuff only if needed - saves some memory! */
@@ -607,8 +607,6 @@ sensors_show_graphical_display (t_sensors *sensors)
         if (NULL != ptr_cssdatafile) {
             gtk_css_provider_load_from_file(GTK_CSS_PROVIDER(sensors->css_provider),
                                     ptr_cssdatafile, NULL);
-
-            g_object_unref (ptr_cssdatafile);
         }
         else {
             gchar *ptr_cssstring =  "levelbar block.full {\n"
@@ -647,6 +645,7 @@ sensors_show_graphical_display (t_sensors *sensors)
                                    strlen(ptr_cssstring), NULL);
         }
         g_object_unref (sensors->css_provider);
+        sensors->css_provider = NULL;
 
         sensors_add_graphical_display (sensors);
     }

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


More information about the Xfce4-commits mailing list