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:
@@ -204,7 +204,6 @@ set_property (GObject *object,
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsDummyCall *self = CALLS_DUMMY_CALL (object);
|
||||
|
||||
if (self->inbound)
|
||||
@@ -217,7 +216,7 @@ constructed (GObject *object)
|
||||
g_timeout_add_seconds (1, (GSourceFunc)outbound_timeout_cb, self);
|
||||
}
|
||||
|
||||
parent_class->constructed (object);
|
||||
G_OBJECT_CLASS (calls_dummy_call_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -244,12 +243,11 @@ get_property (GObject *object,
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsDummyCall *self = CALLS_DUMMY_CALL (object);
|
||||
|
||||
g_free (self->number);
|
||||
|
||||
parent_class->finalize (object);
|
||||
G_OBJECT_CLASS (calls_dummy_call_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -217,24 +217,22 @@ set_property (GObject *object,
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsDummyOrigin *self = CALLS_DUMMY_ORIGIN (object);
|
||||
|
||||
remove_calls (self, NULL);
|
||||
|
||||
parent_class->dispose (object);
|
||||
G_OBJECT_CLASS (calls_dummy_origin_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsDummyOrigin *self = CALLS_DUMMY_ORIGIN (object);
|
||||
|
||||
g_string_free (self->name, TRUE);
|
||||
|
||||
parent_class->finalize (object);
|
||||
G_OBJECT_CLASS (calls_dummy_origin_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -102,7 +102,6 @@ usr1_handler (CallsDummyProvider *self)
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsDummyProvider *self = CALLS_DUMMY_PROVIDER (object);
|
||||
|
||||
calls_dummy_provider_add_origin (self, "Dummy origin");
|
||||
@@ -111,7 +110,7 @@ constructed (GObject *object)
|
||||
(GSourceFunc)usr1_handler,
|
||||
self);
|
||||
|
||||
parent_class->constructed (object);
|
||||
G_OBJECT_CLASS (calls_dummy_provider_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,13 +135,12 @@ get_property (GObject *object,
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsDummyProvider *self = CALLS_DUMMY_PROVIDER (object);
|
||||
|
||||
g_list_free_full (self->origins, g_object_unref);
|
||||
self->origins = NULL;
|
||||
|
||||
parent_class->dispose (object);
|
||||
G_OBJECT_CLASS (calls_dummy_provider_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user