[epiphany/wip/sync] sync: Free reference counted stuff in finalize
- From: Gabriel Ivașcu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/sync] sync: Free reference counted stuff in finalize
- Date: Tue, 1 Aug 2017 01:55:58 +0000 (UTC)
commit ed9b6bee186820e58a5ae1b77b56319ed4d146bc
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date: Tue Aug 1 03:53:06 2017 +0300
sync: Free reference counted stuff in finalize
lib/sync/ephy-history-record.c | 14 +++++++-------
lib/sync/ephy-open-tabs-manager.c | 7 +++----
lib/sync/ephy-open-tabs-record.c | 11 +++++------
lib/sync/ephy-password-record.c | 20 ++++++++++----------
lib/sync/ephy-sync-service.c | 25 ++++++++++++++++++-------
5 files changed, 43 insertions(+), 34 deletions(-)
---
diff --git a/lib/sync/ephy-history-record.c b/lib/sync/ephy-history-record.c
index fc80392..93287f6 100644
--- a/lib/sync/ephy-history-record.c
+++ b/lib/sync/ephy-history-record.c
@@ -149,16 +149,16 @@ ephy_history_record_get_property (GObject *object,
}
static void
-ephy_history_record_dispose (GObject *object)
+ephy_history_record_finalize (GObject *object)
{
EphyHistoryRecord *self = EPHY_HISTORY_RECORD (object);
- g_clear_pointer (&self->id, g_free);
- g_clear_pointer (&self->title, g_free);
- g_clear_pointer (&self->uri, g_free);
- g_clear_pointer (&self->visits, g_sequence_free);
+ g_free (self->id);
+ g_free (self->title);
+ g_free (self->uri);
+ g_sequence_free (self->visits);
- G_OBJECT_CLASS (ephy_history_record_parent_class)->dispose (object);
+ G_OBJECT_CLASS (ephy_history_record_parent_class)->finalize (object);
}
static void
@@ -168,7 +168,7 @@ ephy_history_record_class_init (EphyHistoryRecordClass *klass)
object_class->set_property = ephy_history_record_set_property;
object_class->get_property = ephy_history_record_get_property;
- object_class->dispose = ephy_history_record_dispose;
+ object_class->finalize = ephy_history_record_finalize;
obj_properties[PROP_ID] =
g_param_spec_string ("id",
diff --git a/lib/sync/ephy-open-tabs-manager.c b/lib/sync/ephy-open-tabs-manager.c
index 5b5d2be..882617d 100644
--- a/lib/sync/ephy-open-tabs-manager.c
+++ b/lib/sync/ephy-open-tabs-manager.c
@@ -42,14 +42,13 @@ G_DEFINE_TYPE_WITH_CODE (EphyOpenTabsManager, ephy_open_tabs_manager, G_TYPE_OBJ
ephy_synchronizable_manager_iface_init))
static void
-ephy_open_tabs_manager_dispose (GObject *object)
+ephy_open_tabs_manager_finalize (GObject *object)
{
EphyOpenTabsManager *self = EPHY_OPEN_TABS_MANAGER (object);
g_slist_free_full (self->remote_records, g_object_unref);
- self->remote_records = NULL;
- G_OBJECT_CLASS (ephy_open_tabs_manager_parent_class)->dispose (object);
+ G_OBJECT_CLASS (ephy_open_tabs_manager_parent_class)->finalize (object);
}
static void
@@ -57,7 +56,7 @@ ephy_open_tabs_manager_class_init (EphyOpenTabsManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = ephy_open_tabs_manager_dispose;
+ object_class->finalize = ephy_open_tabs_manager_finalize;
}
static void
diff --git a/lib/sync/ephy-open-tabs-record.c b/lib/sync/ephy-open-tabs-record.c
index c10a7ec..065d63f 100644
--- a/lib/sync/ephy-open-tabs-record.c
+++ b/lib/sync/ephy-open-tabs-record.c
@@ -109,16 +109,15 @@ ephy_open_tabs_record_get_property (GObject *object,
}
static void
-ephy_open_tabs_record_dispose (GObject *object)
+ephy_open_tabs_record_finalize (GObject *object)
{
EphyOpenTabsRecord *self = EPHY_OPEN_TABS_RECORD (object);
- g_clear_pointer (&self->id, g_free);
- g_clear_pointer (&self->client_name, g_free);
+ g_free (self->id);
+ g_free (self->client_name);
g_slist_free_full (self->tabs, (GDestroyNotify)json_object_unref);
- self->tabs = NULL;
- G_OBJECT_CLASS (ephy_open_tabs_record_parent_class)->dispose (object);
+ G_OBJECT_CLASS (ephy_open_tabs_record_parent_class)->finalize (object);
}
static void
@@ -128,7 +127,7 @@ ephy_open_tabs_record_class_init (EphyOpenTabsRecordClass *klass)
object_class->set_property = ephy_open_tabs_record_set_property;
object_class->get_property = ephy_open_tabs_record_get_property;
- object_class->dispose = ephy_open_tabs_record_dispose;
+ object_class->finalize = ephy_open_tabs_record_finalize;
obj_properties[PROP_ID] =
g_param_spec_string ("id",
diff --git a/lib/sync/ephy-password-record.c b/lib/sync/ephy-password-record.c
index 63ffc6b..99060fd 100644
--- a/lib/sync/ephy-password-record.c
+++ b/lib/sync/ephy-password-record.c
@@ -154,19 +154,19 @@ ephy_password_record_get_property (GObject *object,
}
static void
-ephy_password_record_dispose (GObject *object)
+ephy_password_record_finalize (GObject *object)
{
EphyPasswordRecord *self = EPHY_PASSWORD_RECORD (object);
- g_clear_pointer (&self->id, g_free);
- g_clear_pointer (&self->hostname, g_free);
- g_clear_pointer (&self->form_submit_url, g_free);
- g_clear_pointer (&self->username, g_free);
- g_clear_pointer (&self->password, g_free);
- g_clear_pointer (&self->username_field, g_free);
- g_clear_pointer (&self->password_field, g_free);
+ g_free (self->id);
+ g_free (self->hostname);
+ g_free (self->form_submit_url);
+ g_free (self->username);
+ g_free (self->password);
+ g_free (self->username_field);
+ g_free (self->password_field);
- G_OBJECT_CLASS (ephy_password_record_parent_class)->dispose (object);
+ G_OBJECT_CLASS (ephy_password_record_parent_class)->finalize (object);
}
static void
@@ -176,7 +176,7 @@ ephy_password_record_class_init (EphyPasswordRecordClass *klass)
object_class->set_property = ephy_password_record_set_property;
object_class->get_property = ephy_password_record_get_property;
- object_class->dispose = ephy_password_record_dispose;
+ object_class->finalize = ephy_password_record_finalize;
obj_properties[PROP_ID] =
g_param_spec_string ("id",
diff --git a/lib/sync/ephy-sync-service.c b/lib/sync/ephy-sync-service.c
index e04892e..d9b88c5 100644
--- a/lib/sync/ephy-sync-service.c
+++ b/lib/sync/ephy-sync-service.c
@@ -1577,21 +1577,31 @@ ephy_sync_service_store_secrets (EphySyncService *self)
}
static void
-ephy_sync_service_dispose (GObject *object)
+ephy_sync_service_finalize (GObject *object)
{
EphySyncService *self = EPHY_SYNC_SERVICE (object);
if (ephy_sync_utils_user_is_signed_in ())
ephy_sync_service_stop_periodical_sync (self);
+ if (self->key_pair)
+ ephy_sync_crypto_rsa_key_pair_free (self->key_pair);
+
+ g_free (self->crypto_keys);
+ g_slist_free (self->managers);
+ g_queue_free_full (self->storage_queue, (GDestroyNotify)storage_request_async_data_free);
ephy_sync_service_clear_storage_credentials (self);
+
+ G_OBJECT_CLASS (ephy_sync_service_parent_class)->finalize (object);
+}
+
+static void
+ephy_sync_service_dispose (GObject *object)
+{
+ EphySyncService *self = EPHY_SYNC_SERVICE (object);
+
g_clear_object (&self->session);
- g_clear_pointer (&self->crypto_keys, g_free);
- g_clear_pointer (&self->key_pair, ephy_sync_crypto_rsa_key_pair_free);
- g_clear_pointer (&self->secrets, g_hash_table_destroy);
- g_clear_pointer (&self->managers, g_slist_free);
- g_queue_free_full (self->storage_queue, (GDestroyNotify)storage_request_async_data_free);
- self->storage_queue = NULL;
+ g_clear_pointer (&self->secrets, g_hash_table_unref);
G_OBJECT_CLASS (ephy_sync_service_parent_class)->dispose (object);
}
@@ -1635,6 +1645,7 @@ ephy_sync_service_class_init (EphySyncServiceClass *klass)
object_class->get_property = ephy_sync_service_get_property;
object_class->constructed = ephy_sync_service_constructed;
object_class->dispose = ephy_sync_service_dispose;
+ object_class->finalize = ephy_sync_service_finalize;
obj_properties[PROP_SYNC_PERIODICALLY] =
g_param_spec_boolean ("sync-periodically",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]