mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 19:18:00 +02:00
ifcfg-rh: remove the watch on finalize
This commit is contained in:
parent
16f8651908
commit
0ae44fe7e2
1 changed files with 7 additions and 6 deletions
|
|
@ -15,7 +15,7 @@
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 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"
|
#include "nm-default.h"
|
||||||
|
|
@ -44,6 +44,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int ifd;
|
int ifd;
|
||||||
|
guint inotify_id;
|
||||||
GHashTable *wd_refs;
|
GHashTable *wd_refs;
|
||||||
} NMInotifyHelperPrivate;
|
} NMInotifyHelperPrivate;
|
||||||
|
|
||||||
|
|
@ -142,7 +143,6 @@ init_inotify (NMInotifyHelper *self)
|
||||||
{
|
{
|
||||||
NMInotifyHelperPrivate *priv = NM_INOTIFY_HELPER_GET_PRIVATE (self);
|
NMInotifyHelperPrivate *priv = NM_INOTIFY_HELPER_GET_PRIVATE (self);
|
||||||
GIOChannel *channel;
|
GIOChannel *channel;
|
||||||
guint source_id;
|
|
||||||
|
|
||||||
priv->ifd = inotify_init1 (IN_CLOEXEC);
|
priv->ifd = inotify_init1 (IN_CLOEXEC);
|
||||||
if (priv->ifd == -1) {
|
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_flags (channel, G_IO_FLAG_NONBLOCK, NULL);
|
||||||
g_io_channel_set_encoding (channel, NULL, NULL);
|
g_io_channel_set_encoding (channel, NULL, NULL);
|
||||||
|
|
||||||
source_id = g_io_add_watch (channel,
|
priv->inotify_id = g_io_add_watch (channel,
|
||||||
G_IO_IN | G_IO_ERR,
|
G_IO_IN | G_IO_ERR,
|
||||||
(GIOFunc) inotify_event_handler,
|
(GIOFunc) inotify_event_handler,
|
||||||
(gpointer) self);
|
(gpointer) self);
|
||||||
g_io_channel_unref (channel);
|
g_io_channel_unref (channel);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -188,6 +188,7 @@ finalize (GObject *object)
|
||||||
{
|
{
|
||||||
NMInotifyHelperPrivate *priv = NM_INOTIFY_HELPER_GET_PRIVATE ((NMInotifyHelper *) object);
|
NMInotifyHelperPrivate *priv = NM_INOTIFY_HELPER_GET_PRIVATE ((NMInotifyHelper *) object);
|
||||||
|
|
||||||
|
nm_clear_g_source (&priv->inotify_id);
|
||||||
nm_close (priv->ifd);
|
nm_close (priv->ifd);
|
||||||
|
|
||||||
g_hash_table_destroy (priv->wd_refs);
|
g_hash_table_destroy (priv->wd_refs);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue