From 0ae44fe7e28ea635f727ea524c31b590d26ebecc Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 18 Dec 2017 13:22:44 +0100 Subject: [PATCH] ifcfg-rh: remove the watch on finalize --- src/settings/plugins/ifcfg-rh/nm-inotify-helper.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/settings/plugins/ifcfg-rh/nm-inotify-helper.c b/src/settings/plugins/ifcfg-rh/nm-inotify-helper.c index 51b180b233..2863df64d5 100644 --- a/src/settings/plugins/ifcfg-rh/nm-inotify-helper.c +++ b/src/settings/plugins/ifcfg-rh/nm-inotify-helper.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 Red Hat, Inc. + * (C) Copyright 2008 - 2017 Red Hat, Inc. */ #include "nm-default.h" @@ -44,6 +44,7 @@ static guint signals[LAST_SIGNAL] = { 0 }; typedef struct { int ifd; + guint inotify_id; GHashTable *wd_refs; } NMInotifyHelperPrivate; @@ -142,7 +143,6 @@ init_inotify (NMInotifyHelper *self) { NMInotifyHelperPrivate *priv = NM_INOTIFY_HELPER_GET_PRIVATE (self); GIOChannel *channel; - guint source_id; priv->ifd = inotify_init1 (IN_CLOEXEC); if (priv->ifd == -1) { @@ -157,10 +157,10 @@ init_inotify (NMInotifyHelper *self) g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL); g_io_channel_set_encoding (channel, NULL, NULL); - source_id = g_io_add_watch (channel, - G_IO_IN | G_IO_ERR, - (GIOFunc) inotify_event_handler, - (gpointer) self); + priv->inotify_id = g_io_add_watch (channel, + G_IO_IN | G_IO_ERR, + (GIOFunc) inotify_event_handler, + (gpointer) self); g_io_channel_unref (channel); return TRUE; } @@ -188,6 +188,7 @@ finalize (GObject *object) { NMInotifyHelperPrivate *priv = NM_INOTIFY_HELPER_GET_PRIVATE ((NMInotifyHelper *) object); + nm_clear_g_source (&priv->inotify_id); nm_close (priv->ifd); g_hash_table_destroy (priv->wd_refs);