[network-manager-openvpn: 1/6] service: add dispose() function to service plugin
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn: 1/6] service: add dispose() function to service plugin
- Date: Tue, 2 Feb 2016 16:59:25 +0000 (UTC)
commit deb93f2241983149115949895f52970c2a9067c9
Author: Thomas Haller <thaller redhat com>
Date: Tue Feb 2 17:51:22 2016 +0100
service: add dispose() function to service plugin
src/nm-openvpn-service.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index 4ca2e3d..704e01a 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -50,6 +50,7 @@
#include "nm-openvpn-service.h"
#include "nm-utils.h"
#include "utils.h"
+#include "nm-macros-internal.h"
#if !defined(DIST_VERSION)
# define DIST_VERSION VERSION
@@ -1730,6 +1731,16 @@ nm_openvpn_plugin_init (NMOpenvpnPlugin *plugin)
}
static void
+dispose (GObject *object)
+{
+ NMOpenvpnPluginPrivate *priv = NM_OPENVPN_PLUGIN_GET_PRIVATE (object);
+
+ nm_clear_g_source (&priv->connect_timer);
+
+ G_OBJECT_CLASS (nm_openvpn_plugin_parent_class)->dispose (object);
+}
+
+static void
nm_openvpn_plugin_class_init (NMOpenvpnPluginClass *plugin_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (plugin_class);
@@ -1737,6 +1748,8 @@ nm_openvpn_plugin_class_init (NMOpenvpnPluginClass *plugin_class)
g_type_class_add_private (object_class, sizeof (NMOpenvpnPluginPrivate));
+ object_class->dispose = dispose;
+
/* virtual methods */
parent_class->connect = real_connect;
parent_class->connect_interactive = real_connect_interactive;
@@ -1759,10 +1772,7 @@ plugin_state_changed (NMOpenvpnPlugin *plugin,
case NM_VPN_SERVICE_STATE_STOPPING:
case NM_VPN_SERVICE_STATE_STOPPED:
/* Cleanup on failure */
- if (priv->connect_timer) {
- g_source_remove (priv->connect_timer);
- priv->connect_timer = 0;
- }
+ nm_clear_g_source (&priv->connect_timer);
nm_openvpn_disconnect_management_socket (plugin);
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]