From a90b7f0e96fbc3e1fdc00dd02d69e00a867836a2 Mon Sep 17 00:00:00 2001 From: lukefromdc Date: Fri, 4 Aug 2017 02:43:59 -0400 Subject: Clock: fix removal warnings when in-process applet removed --- applets/clock/clock.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'applets/clock/clock.c') diff --git a/applets/clock/clock.c b/applets/clock/clock.c index c081e3c3..c765b7ef 100644 --- a/applets/clock/clock.c +++ b/applets/clock/clock.c @@ -501,6 +501,8 @@ get_updated_timeformat (ClockData *cd) static void update_timeformat (ClockData *cd) { + if (cd->settings == NULL) + return; if (cd->timeformat) g_free (cd->timeformat); cd->timeformat = get_updated_timeformat (cd); @@ -701,6 +703,8 @@ update_tooltip (ClockData * cd) static void refresh_clock (ClockData *cd) { + if (cd->settings == NULL) + return; unfix_size (cd); update_clock (cd); } @@ -708,6 +712,9 @@ refresh_clock (ClockData *cd) static void refresh_clock_timeout(ClockData *cd) { + if (cd->settings == NULL) + return; + unfix_size (cd); update_timeformat (cd); @@ -763,12 +770,10 @@ destroy_clock (GtkWidget * widget, ClockData *cd) if (cd->calendar_popup) gtk_widget_destroy (cd->calendar_popup); -/* FIXME this stops segfaults on removing the clock applet when it is*/ -/* built in-process but leaves part of it in RAM until the panel is restarted */ -#ifndef CLOCK_INPROCESS cd->calendar_popup = NULL; g_free (cd->timeformat); + g_free (cd->custom_format); free_locations (cd); @@ -793,7 +798,6 @@ destroy_clock (GtkWidget * widget, ClockData *cd) } g_free (cd); -#endif } static gboolean @@ -1994,6 +1998,9 @@ static void update_weather_bool_value_and_toggle_from_gsettings (ClockData *cd, gchar *key, gboolean *value_loc, const char *widget_name) { + if (cd->settings == NULL) + return; + GtkWidget *widget; gboolean value; @@ -2073,6 +2080,9 @@ location_set_current_cb (ClockLocation *loc, static void locations_changed (ClockData *cd) { + if (cd->settings == NULL) + return; + GList *l; ClockLocation *loc; glong id; @@ -2276,6 +2286,9 @@ temperature_unit_changed (GSettings *settings, gchar *key, ClockData *cd) { + if (cd->settings == NULL) + return; + cd->temperature_unit = g_settings_get_enum (settings, key); if (cd->temperature_unit > 0) { @@ -2294,6 +2307,9 @@ speed_unit_changed (GSettings *settings, gchar *key, ClockData *cd) { + if (cd->settings == NULL) + return; + cd->speed_unit = g_settings_get_enum (settings, key); if (cd->speed_unit > 0) { @@ -2312,6 +2328,9 @@ custom_format_changed (GSettings *settings, gchar *key, ClockData *clock) { + if (clock->settings == NULL) + return; + gchar *value; value = g_settings_get_string (settings, key); -- cgit v1.2.1