[glib] GApplication: Assert that dbus_unregister was called before destruction
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GApplication: Assert that dbus_unregister was called before destruction
- Date: Thu, 20 Jul 2017 13:45:39 +0000 (UTC)
commit c1ae1170fa47483b9bcb30de8cd346cbc4fe10e3
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Jun 19 16:16:08 2017 +0200
GApplication: Assert that dbus_unregister was called before destruction
Invoking the dbus_unregister virtual method during destruction is
problematic. It would happen after a sub-class has dropped its
references to its instance objects, and it is surprising to be asked to
unexport exported D-Bus objects after that.
This problem was masked as a side-effect of commit 21b1c390a3ce1f7e.
Let's ensure that it doesn't regress by asserting that dbus_unregister
has happened before destruction.
Based on a patch by Giovanni Campagna.
https://bugzilla.gnome.org/show_bug.cgi?id=725950
gio/gapplication.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/gio/gapplication.c b/gio/gapplication.c
index c00973d..991e5d8 100644
--- a/gio/gapplication.c
+++ b/gio/gapplication.c
@@ -1243,10 +1243,23 @@ g_application_constructed (GObject *object)
}
static void
+g_application_dispose (GObject *object)
+{
+ GApplication *application = G_APPLICATION (object);
+
+ g_assert_null (application->priv->impl);
+
+ G_OBJECT_CLASS (g_application_parent_class)
+ ->dispose (object);
+}
+
+static void
g_application_finalize (GObject *object)
{
GApplication *application = G_APPLICATION (object);
+ g_assert_null (application->priv->impl);
+
g_slist_free_full (application->priv->option_groups, (GDestroyNotify) g_option_group_unref);
if (application->priv->main_options)
g_option_group_unref (application->priv->main_options);
@@ -1254,9 +1267,6 @@ g_application_finalize (GObject *object)
g_hash_table_unref (application->priv->packed_options);
g_slist_free_full (application->priv->option_strings, g_free);
-
- if (application->priv->impl)
- g_application_impl_destroy (application->priv->impl);
g_free (application->priv->id);
if (g_application_get_default () == application)
@@ -1314,6 +1324,7 @@ g_application_class_init (GApplicationClass *class)
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->constructed = g_application_constructed;
+ object_class->dispose = g_application_dispose;
object_class->finalize = g_application_finalize;
object_class->get_property = g_application_get_property;
object_class->set_property = g_application_set_property;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]