PKGBUILDs/extra/sensors-applet/fix-crash-destroying-active-sensor.patch
2023-05-29 21:48:20 +00:00

56 lines
2.2 KiB
Diff

From: Alberts Muktupāvels <alberts.muktupavels@gmail.com>
Date: Sat, 28 Mar 2020 19:38:07 +0200
Subject: fix crash destroying active sensor
---
sensors-applet/active-sensor.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/sensors-applet/active-sensor.c b/sensors-applet/active-sensor.c
index 725e050..9fe4718 100644
--- a/sensors-applet/active-sensor.c
+++ b/sensors-applet/active-sensor.c
@@ -347,17 +347,17 @@ static void active_sensor_update_graph(ActiveSensor *as) {
void active_sensor_destroy(ActiveSensor *active_sensor) {
g_debug("-- destroying active sensor label...");
- gtk_widget_destroy(active_sensor->label);
+ g_object_unref(active_sensor->label);
g_debug("-- destroying active sensor icon..");
- gtk_widget_destroy(active_sensor->icon);
+ g_object_unref(active_sensor->icon);
g_debug("-- destroying active sensor value...");
- gtk_widget_destroy(active_sensor->value);
+ g_object_unref(active_sensor->value);
g_debug("-- destroying active sensor graph and frame...");
- gtk_widget_destroy(active_sensor->graph);
- gtk_widget_destroy(active_sensor->graph_frame);
+ g_object_unref(active_sensor->graph);
+ g_object_unref(active_sensor->graph_frame);
g_debug("-- destroying active sensor values...");
g_free(active_sensor->sensor_values);
@@ -450,11 +450,20 @@ ActiveSensor *active_sensor_new(SensorsApplet *sensors_applet,
}
active_sensor->label = gtk_label_new("");
+ g_object_ref_sink (active_sensor->label);
+
active_sensor->value = gtk_label_new("");
+ g_object_ref_sink (active_sensor->value);
+
active_sensor->icon = gtk_image_new();
+ g_object_ref_sink (active_sensor->icon);
active_sensor->graph = gtk_drawing_area_new();
+ g_object_ref_sink (active_sensor->graph);
+
active_sensor->graph_frame = gtk_frame_new(NULL);
+ g_object_ref_sink (active_sensor->graph_frame);
+
gtk_frame_set_shadow_type(GTK_FRAME(active_sensor->graph_frame),
GTK_SHADOW_IN);
gtk_container_add(GTK_CONTAINER(active_sensor->graph_frame),