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:
@@ -423,7 +423,6 @@ app_open (GApplication *application,
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_APPLICATION);
|
||||
CallsApplication *self = CALLS_APPLICATION (object);
|
||||
GSimpleActionGroup *action_group;
|
||||
|
||||
@@ -432,7 +431,7 @@ constructed (GObject *object)
|
||||
actions, G_N_ELEMENTS (actions), self);
|
||||
g_object_unref (action_group);
|
||||
|
||||
parent_class->constructed (object);
|
||||
G_OBJECT_CLASS (calls_application_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -113,13 +113,12 @@ get_property (GObject *object,
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsCallData *self = CALLS_CALL_DATA (object);
|
||||
|
||||
g_clear_object (&self->call);
|
||||
g_clear_object (&self->party);
|
||||
|
||||
parent_class->dispose (object);
|
||||
G_OBJECT_CLASS (calls_call_data_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -513,7 +513,6 @@ ugly_hacks (CallsCallDisplay *self)
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_OVERLAY);
|
||||
CallsCallDisplay *self = CALLS_CALL_DISPLAY (object);
|
||||
|
||||
self->timer = g_timer_new ();
|
||||
@@ -522,7 +521,7 @@ constructed (GObject *object)
|
||||
|
||||
ugly_hacks (self);
|
||||
|
||||
parent_class->constructed (object);
|
||||
G_OBJECT_CLASS (calls_call_display_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -565,24 +564,22 @@ calls_call_display_init (CallsCallDisplay *self)
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_OVERLAY);
|
||||
CallsCallDisplay *self = CALLS_CALL_DISPLAY (object);
|
||||
|
||||
stop_timeout (self);
|
||||
g_clear_object (&self->call);
|
||||
|
||||
parent_class->dispose (object);
|
||||
G_OBJECT_CLASS (calls_call_display_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_OVERLAY);
|
||||
CallsCallDisplay *self = CALLS_CALL_DISPLAY (object);
|
||||
|
||||
g_timer_destroy (self->timer);
|
||||
|
||||
parent_class->finalize (object);
|
||||
G_OBJECT_CLASS (calls_call_display_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -134,14 +134,13 @@ calls_call_holder_init (CallsCallHolder *self)
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsCallHolder *self = CALLS_CALL_HOLDER (object);
|
||||
|
||||
g_clear_object (&self->selector_item);
|
||||
g_clear_object (&self->display);
|
||||
g_clear_object (&self->data);
|
||||
|
||||
parent_class->dispose (object);
|
||||
G_OBJECT_CLASS (calls_call_holder_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -477,7 +477,6 @@ set_property (GObject *object,
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
GObjectClass *obj_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsCallRecordRow *self = CALLS_CALL_RECORD_ROW (object);
|
||||
gboolean inbound;
|
||||
GDateTime *answered;
|
||||
@@ -497,7 +496,7 @@ constructed (GObject *object)
|
||||
contact_name_cb (self);
|
||||
request_contact_avatar (self);
|
||||
|
||||
obj_class->constructed (object);
|
||||
G_OBJECT_CLASS (calls_call_record_row_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -524,7 +523,6 @@ get_property (GObject *object,
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
GObjectClass *obj_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsCallRecordRow *self = CALLS_CALL_RECORD_ROW (object);
|
||||
|
||||
g_clear_object (&self->new_call);
|
||||
@@ -537,7 +535,7 @@ dispose (GObject *object)
|
||||
calls_clear_signal (self->record, &self->end_notify_handler_id);
|
||||
g_clear_object (&self->record);
|
||||
|
||||
obj_class->dispose (object);
|
||||
G_OBJECT_CLASS (calls_call_record_row_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -146,7 +146,6 @@ set_property (GObject *object,
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsCallRecord *self = CALLS_CALL_RECORD (object);
|
||||
|
||||
g_clear_pointer (&self->end, g_date_time_unref);
|
||||
@@ -154,7 +153,7 @@ finalize (GObject *object)
|
||||
g_clear_pointer (&self->start, g_date_time_unref);
|
||||
g_free (self->target);
|
||||
|
||||
parent_class->finalize (object);
|
||||
G_OBJECT_CLASS (calls_call_record_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -152,12 +152,11 @@ calls_call_selector_item_init (CallsCallSelectorItem *self)
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_EVENT_BOX);
|
||||
CallsCallSelectorItem *self = CALLS_CALL_SELECTOR_ITEM (object);
|
||||
|
||||
g_clear_object (&self->display);
|
||||
|
||||
parent_class->dispose (object);
|
||||
G_OBJECT_CLASS (calls_call_selector_item_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -639,7 +639,6 @@ notify (GObject *object,
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_APPLICATION_WINDOW);
|
||||
CallsCallWindow *self = CALLS_CALL_WINDOW (object);
|
||||
|
||||
gtk_flow_box_bind_model (self->call_selector,
|
||||
@@ -649,7 +648,7 @@ constructed (GObject *object)
|
||||
|
||||
update_visibility (self);
|
||||
|
||||
parent_class->constructed (object);
|
||||
G_OBJECT_CLASS (calls_call_window_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -665,7 +664,6 @@ calls_call_window_init (CallsCallWindow *self)
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_APPLICATION_WINDOW);
|
||||
CallsCallWindow *self = CALLS_CALL_WINDOW (object);
|
||||
|
||||
if (self->call_holders)
|
||||
@@ -676,7 +674,7 @@ dispose (GObject *object)
|
||||
g_clear_object (&self->call_holders);
|
||||
stop_info_timeout (self);
|
||||
|
||||
parent_class->dispose (object);
|
||||
G_OBJECT_CLASS (calls_call_window_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -98,7 +98,6 @@ set_property (GObject *object,
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsEnumerateParams *self = CALLS_ENUMERATE_PARAMS (object);
|
||||
|
||||
unsigned i;
|
||||
@@ -107,7 +106,7 @@ finalize (GObject *object)
|
||||
g_hash_table_unref (self->callbacks[i]);
|
||||
}
|
||||
|
||||
parent_class->finalize (object);
|
||||
G_OBJECT_CLASS (calls_enumerate_params_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -151,7 +151,6 @@ set_property (GObject *object,
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsHistoryBox *self = CALLS_HISTORY_BOX (object);
|
||||
|
||||
g_assert (self->model != NULL);
|
||||
@@ -174,21 +173,20 @@ constructed (GObject *object)
|
||||
|
||||
update (self);
|
||||
|
||||
parent_class->constructed (object);
|
||||
G_OBJECT_CLASS (calls_history_box_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsHistoryBox *self = CALLS_HISTORY_BOX (object);
|
||||
|
||||
g_clear_object (&self->new_call);
|
||||
g_clear_object (&self->contacts);
|
||||
g_clear_object (&self->model);
|
||||
|
||||
parent_class->dispose (object);
|
||||
G_OBJECT_CLASS (calls_history_box_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -254,7 +254,6 @@ set_up_provider (CallsMainWindow *self)
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsMainWindow *self = CALLS_MAIN_WINDOW (object);
|
||||
GSimpleActionGroup *simple_action_group;
|
||||
GtkContainer *main_stack = GTK_CONTAINER (self->main_stack);
|
||||
@@ -309,7 +308,7 @@ constructed (GObject *object)
|
||||
self->title_label,
|
||||
NULL);
|
||||
|
||||
parent_class->constructed (object);
|
||||
G_OBJECT_CLASS (calls_main_window_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -317,7 +316,6 @@ constructed (GObject *object)
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsMainWindow *self = CALLS_MAIN_WINDOW (object);
|
||||
|
||||
stop_info_timeout (self);
|
||||
@@ -325,7 +323,7 @@ dispose (GObject *object)
|
||||
g_clear_object (&self->record_store);
|
||||
g_clear_object (&self->provider);
|
||||
|
||||
parent_class->dispose (object);
|
||||
G_OBJECT_CLASS (calls_main_window_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -334,7 +332,6 @@ size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
CallsMainWindow *self = CALLS_MAIN_WINDOW (widget);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (calls_main_window_parent_class);
|
||||
|
||||
hdy_squeezer_set_child_enabled (self->squeezer,
|
||||
GTK_WIDGET (self->wide_switcher),
|
||||
@@ -343,7 +340,7 @@ size_allocate (GtkWidget *widget,
|
||||
GTK_WIDGET (self->narrow_switcher),
|
||||
allocation->width > 400);
|
||||
|
||||
widget_class->size_allocate (widget, allocation);
|
||||
GTK_WIDGET_CLASS (calls_main_window_parent_class)->size_allocate (widget, allocation);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -301,7 +301,6 @@ calls_new_call_box_init (CallsNewCallBox *self)
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsNewCallBox *self = CALLS_NEW_CALL_BOX (object);
|
||||
|
||||
clear_dial_queue (self);
|
||||
@@ -311,7 +310,7 @@ dispose (GObject *object)
|
||||
remove_origins (self);
|
||||
}
|
||||
|
||||
parent_class->dispose (object);
|
||||
G_OBJECT_CLASS (calls_new_call_box_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -163,13 +163,12 @@ set_property (GObject *object,
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsParty *self = CALLS_PARTY (object);
|
||||
|
||||
CALLS_SET_PTR_PROPERTY (self->number, NULL);
|
||||
CALLS_SET_PTR_PROPERTY (self->name, NULL);
|
||||
|
||||
parent_class->finalize (object);
|
||||
G_OBJECT_CLASS (calls_party_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -680,20 +680,18 @@ set_up_provider (CallsRecordStore *self)
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsRecordStore *self = CALLS_RECORD_STORE (object);
|
||||
|
||||
open_repo (self);
|
||||
set_up_provider (self);
|
||||
|
||||
parent_class->constructed (object);
|
||||
G_OBJECT_CLASS (calls_record_store_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsRecordStore *self = CALLS_RECORD_STORE (object);
|
||||
|
||||
g_clear_object (&self->provider);
|
||||
@@ -703,19 +701,18 @@ dispose (GObject *object)
|
||||
g_clear_object (&self->repository);
|
||||
close_adapter (self);
|
||||
|
||||
parent_class->dispose (object);
|
||||
G_OBJECT_CLASS (calls_record_store_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsRecordStore *self = CALLS_RECORD_STORE (object);
|
||||
|
||||
g_free (self->filename);
|
||||
|
||||
parent_class->finalize (object);
|
||||
G_OBJECT_CLASS (calls_record_store_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -389,38 +389,35 @@ set_up_provider (CallsRinger *self)
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsRinger *self = CALLS_RINGER (object);
|
||||
|
||||
monitor_theme_name (self);
|
||||
create_ctx (self);
|
||||
set_up_provider (self);
|
||||
|
||||
parent_class->constructed (object);
|
||||
G_OBJECT_CLASS (calls_ringer_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsRinger *self = CALLS_RINGER (object);
|
||||
|
||||
g_clear_object (&self->provider);
|
||||
|
||||
parent_class->dispose (object);
|
||||
G_OBJECT_CLASS (calls_ringer_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||
CallsRinger *self = CALLS_RINGER (object);
|
||||
|
||||
g_free (self->theme_name);
|
||||
|
||||
parent_class->finalize (object);
|
||||
G_OBJECT_CLASS (calls_ringer_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user