Remove unnecessary g_object_unref() in gswe_moment_dispose()

This commit is contained in:
Gergely Polonkai 2014-10-31 18:43:53 +01:00
parent bf4fad5388
commit 185c235b6b

View File

@ -287,6 +287,7 @@ gswe_moment_timestamp_changed(GsweTimestamp *timestamp, GsweMoment *moment)
gswe_moment_emit_changed(moment); gswe_moment_emit_changed(moment);
} }
/* Dispose object */
static void static void
gswe_moment_dispose(GObject *gobject) gswe_moment_dispose(GObject *gobject)
{ {
@ -302,6 +303,7 @@ gswe_moment_dispose(GObject *gobject)
G_OBJECT_CLASS(gswe_moment_parent_class)->dispose(gobject); G_OBJECT_CLASS(gswe_moment_parent_class)->dispose(gobject);
} }
/* Reset object to the initialized state */
static void static void
gswe_moment_finalize(GObject *gobject) gswe_moment_finalize(GObject *gobject)
{ {
@ -323,10 +325,34 @@ gswe_moment_finalize(GObject *gobject)
moment->priv->antiscia_list, moment->priv->antiscia_list,
(GDestroyNotify)gswe_antiscion_data_unref (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); gswe_moon_phase_data_unref(moment->priv->moon_phase);
g_hash_table_unref(moment->priv->element_points); moment->priv->moon_phase = gswe_moon_phase_data_new();
g_hash_table_unref(moment->priv->quality_points);
G_OBJECT_CLASS(gswe_moment_parent_class)->finalize(gobject); G_OBJECT_CLASS(gswe_moment_parent_class)->finalize(gobject);
} }