diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2017-12-18 13:22:44 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2017-12-18 13:29:32 +0100 |
commit | 0ae44fe7e28ea635f727ea524c31b590d26ebecc (patch) | |
tree | 8ac05588bc736e409dfd9c81d4bfb89316ae7390 | |
parent | 16f8651908dbda630047230257802433580510a3 (diff) | |
download | NetworkManager-0ae44fe7e28ea635f727ea524c31b590d26ebecc.tar.gz |
ifcfg-rh: remove the watch on finalize
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nm-inotify-helper.c | 13 |
1 files 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); |