Reset source id to prevent double free

Fixes in particular a GLib-CRITICAL when closing the prefs dialog.
master
Gaël Bonithon 2021-03-29 01:06:01 +02:00 committed by Romain Bouvier
parent a828d9c7c8
commit 07c54643bd
1 changed files with 5 additions and 0 deletions

View File

@ -336,6 +336,7 @@ static void monitor_set_mode (XfcePanelPlugin *plugin, XfcePanelPluginMode mode,
if (global->timeout_id) if (global->timeout_id)
{ {
g_source_remove(global->timeout_id); g_source_remove(global->timeout_id);
global->timeout_id = 0;
} }
if (mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR) if (mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR)
@ -408,6 +409,7 @@ static void monitor_free(XfcePanelPlugin *plugin, t_global_monitor *global)
if (global->timeout_id) if (global->timeout_id)
{ {
g_source_remove(global->timeout_id); g_source_remove(global->timeout_id);
global->timeout_id = 0;
} }
if (global->monitor->options.label_text) if (global->monitor->options.label_text)
@ -554,7 +556,10 @@ static void setup_monitor(t_global_monitor *global, gboolean supress_warnings)
gint i; gint i;
if (global->timeout_id) if (global->timeout_id)
{
g_source_remove(global->timeout_id); g_source_remove(global->timeout_id);
global->timeout_id = 0;
}
/* Show title label? */ /* Show title label? */
if (global->monitor->options.use_label) if (global->monitor->options.use_label)