[glib/mcatanzaro/gdbus-dir-addresses: 93/97] gdbus: Stop server on dispose
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/mcatanzaro/gdbus-dir-addresses: 93/97] gdbus: Stop server on dispose
- Date: Thu, 13 Jun 2019 16:01:54 +0000 (UTC)
commit b308be58654d006da3d5c930d69b29d93c781701
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Wed Jun 12 13:29:52 2019 -0500
gdbus: Stop server on dispose
This is not going to have much any effect currently since stop() just
disconnects a signal handler (that is going to be disconnected in
finalize anyway) and stops the socket service (that is going to be
destroyed in finalize), but it makes sense to do here for robustness.
gio/gdbusserver.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/gio/gdbusserver.c b/gio/gdbusserver.c
index 2f137ecca..1bdb8260c 100644
--- a/gio/gdbusserver.c
+++ b/gio/gdbusserver.c
@@ -161,6 +161,17 @@ static void initable_iface_init (GInitableIface *initable_iface);
G_DEFINE_TYPE_WITH_CODE (GDBusServer, g_dbus_server, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init))
+static void
+g_dbus_server_dispose (GObject *object)
+{
+ GDBusServer *server = G_DBUS_SERVER (object);
+
+ if (server->active)
+ g_dbus_server_stop (server);
+
+ G_OBJECT_CLASS (g_dbus_server_parent_class)->dispose (object);
+}
+
static void
g_dbus_server_finalize (GObject *object)
{
@@ -270,6 +281,7 @@ g_dbus_server_class_init (GDBusServerClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->dispose = g_dbus_server_dispose;
gobject_class->finalize = g_dbus_server_finalize;
gobject_class->set_property = g_dbus_server_set_property;
gobject_class->get_property = g_dbus_server_get_property;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]