Use correct parent class when chaining up overridden functions
How `g_type_class_peek ()` was used it didn't return the correct parent class in most cases. G_DEFINE_TYPE macro creates a pointer we can use to get the parent class `n_p_parent_class`. Because we didn't use the correct parent class the object initialisation wasn't fully completed for some GtkWidgets. See https://developer.gnome.org/gobject/stable/chapter-gobject.html#gobject-instantiation for more information. This commit makes use of the `n_p_parent_class pointer` created for this specific use case where ever possible. Fixes: https://source.puri.sm/Librem5/calls/issues/118
This commit is contained in:
@@ -357,7 +357,6 @@ mm_vanished_cb (GDBusConnection *connection,
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsMMProvider *self = CALLS_MM_PROVIDER (object);
|
||||
|
||||
self->watch_id =
|
||||
@@ -370,7 +369,7 @@ constructed (GObject *object)
|
||||
|
||||
g_debug ("Watching for ModemManager");
|
||||
|
||||
parent_class->constructed (object);
|
||||
G_OBJECT_CLASS (calls_mm_provider_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -397,7 +396,6 @@ get_property (GObject *object,
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsMMProvider *self = CALLS_MM_PROVIDER (object);
|
||||
|
||||
if (self->watch_id)
|
||||
@@ -408,20 +406,19 @@ dispose (GObject *object)
|
||||
|
||||
clear_dbus (self);
|
||||
|
||||
parent_class->dispose (object);
|
||||
G_OBJECT_CLASS (calls_mm_provider_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsMMProvider *self = CALLS_MM_PROVIDER (object);
|
||||
|
||||
g_hash_table_unref (self->origins);
|
||||
g_free (self->status);
|
||||
|
||||
parent_class->finalize (object);
|
||||
G_OBJECT_CLASS (calls_mm_provider_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user