diff --git a/src/gswe-moment.c b/src/gswe-moment.c index 88f44ba..ee22a11 100644 --- a/src/gswe-moment.c +++ b/src/gswe-moment.c @@ -287,6 +287,7 @@ gswe_moment_timestamp_changed(GsweTimestamp *timestamp, GsweMoment *moment) gswe_moment_emit_changed(moment); } +/* Dispose object */ static void gswe_moment_dispose(GObject *gobject) { @@ -302,6 +303,7 @@ gswe_moment_dispose(GObject *gobject) G_OBJECT_CLASS(gswe_moment_parent_class)->dispose(gobject); } +/* Reset object to the initialized state */ static void gswe_moment_finalize(GObject *gobject) { @@ -323,10 +325,34 @@ gswe_moment_finalize(GObject *gobject) moment->priv->antiscia_list, (GDestroyNotify)gswe_antiscion_data_unref ); - g_object_unref(moment->priv->timestamp); + + g_clear_object(&moment->priv->timestamp); + + g_list_free_full(moment->priv->house_list, (GDestroyNotify)gswe_house_data_unref); + moment->priv->house_list = NULL; + + g_list_free_full(moment->priv->planet_list, (GDestroyNotify)gswe_planet_data_unref); + moment->priv->planet_list = NULL; + + g_list_free_full(moment->priv->aspect_list, (GDestroyNotify)gswe_aspect_data_unref); + moment->priv->aspect_list = NULL; + + g_list_free_full(moment->priv->antiscia_list, (GDestroyNotify)gswe_antiscion_data_unref); + moment->priv->antiscia_list = NULL; + + g_hash_table_remove_all(moment->priv->element_points); + + g_hash_table_remove_all(moment->priv->quality_points); + + moment->priv->house_revision = 0; + moment->priv->points_revision = 0; + moment->priv->moon_phase_revision = 0; + moment->priv->aspect_revision = 0; + moment->priv->antiscia_revision = 0; + moment->priv->revision = 1; + gswe_moon_phase_data_unref(moment->priv->moon_phase); - g_hash_table_unref(moment->priv->element_points); - g_hash_table_unref(moment->priv->quality_points); + moment->priv->moon_phase = gswe_moon_phase_data_new(); G_OBJECT_CLASS(gswe_moment_parent_class)->finalize(gobject); }