From: <svn...@op...> - 2009-10-01 14:33:13
|
Author: bellmich Date: Thu Oct 1 16:12:12 2009 New Revision: 1297 URL: http://libsyncml.opensync.org/changeset/1297 Log: - fixed trace statements - added missing cleanup code - added a missing reference to a data store in sml_data_sync.c Modified: trunk/libsyncml/data_sync_api/sml_data_sync.c trunk/libsyncml/data_sync_api/sml_data_sync_data_store_session.c trunk/libsyncml/data_sync_api/sml_data_sync_session.c Modified: trunk/libsyncml/data_sync_api/sml_data_sync.c ============================================================================== --- trunk/libsyncml/data_sync_api/sml_data_sync.c Thu Oct 1 16:09:51 2009 (r1296) +++ trunk/libsyncml/data_sync_api/sml_data_sync.c Thu Oct 1 16:12:12 2009 (r1297) @@ -135,6 +135,7 @@ error = NULL; } smlTransportFree(self->priv->tsp); + self->priv->tsp = NULL; } /* cleanup configuration */ @@ -171,21 +172,26 @@ /* cleanup sessions */ g_hash_table_remove_all(self->priv->data_sync_sessions); g_hash_table_remove_all(self->priv->sessions); + g_hash_table_unref(self->priv->data_sync_sessions); + g_hash_table_unref(self->priv->sessions); + self->priv->data_sync_sessions = NULL; + self->priv->sessions = NULL; if (self->priv->session_mutex) g_mutex_free(self->priv->session_mutex); - -// /* cleanup authentication */ -// if ((*dsObject)->auth) -// smlAuthFree((*dsObject)->auth); - -// /* cleanup device information */ -// if ((*dsObject)->localDevInf) -// g_object_unref((*dsObject)->localDevInf); -// if ((*dsObject)->remoteDevInf) -// g_object_unref((*dsObject)->remoteDevInf); -// if ((*dsObject)->agent) -// smlDevInfAgentFree((*dsObject)->agent); + /* cleanup authentication */ + if (self->priv->auth) + smlAuthFree(self->priv->auth); + + /* cleanup device information */ + if (self->priv->local_dev_inf) { + g_object_unref(self->priv->local_dev_inf); + self->priv->local_dev_inf = NULL; + } + if (self->priv->agent) { + smlDevInfAgentFree(self->priv->agent); + self->priv->agent = NULL; + } /* reset everythig to NULL */ @@ -271,6 +277,7 @@ SmlDataSync* sml_data_sync_new (void) { + smlTrace(TRACE_INTERNAL, "%s", __func__); return g_object_new (SML_TYPE_DATA_SYNC, NULL); } @@ -551,6 +558,7 @@ sml_return_val_error_if_fail (SML_IS_DATA_SYNC_DATA_STORE (ds), FALSE, error, SML_ERROR_GENERIC, "There must be a SmlDataSyncDataStore object."); self->priv->data_stores = g_list_append(self->priv->data_stores, ds); + g_object_ref(ds); sml_data_sync_data_store_set_data_sync(ds, self); return TRUE; } Modified: trunk/libsyncml/data_sync_api/sml_data_sync_data_store_session.c ============================================================================== --- trunk/libsyncml/data_sync_api/sml_data_sync_data_store_session.c Thu Oct 1 16:09:51 2009 (r1296) +++ trunk/libsyncml/data_sync_api/sml_data_sync_data_store_session.c Thu Oct 1 16:12:12 2009 (r1297) @@ -63,6 +63,8 @@ { SmlDataSyncDataStoreSession *self = (SmlDataSyncDataStoreSession *) object; + /* cleanup lists */ + while(self->priv->changes) { SmlDataSyncChangeItem *change = self->priv->changes->data; self->priv->changes = g_list_remove(self->priv->changes, change); @@ -75,14 +77,27 @@ g_object_unref(mapping); } - //if (self->priv->remote_next) - // smlSafeCFree(&(self->priv->remote_ext)); - //if (self->priv->local_next) - // smlSafeCFree(&(self->priv->local_next)); - //if (self->priv->session) - // smlDsSessionUnref(self->priv->session); - //if (self->priv->server) - // smlDsServerFree(self->priv->server); + /* cleanup object references */ + + if (self->priv->data_store_session) { + smlDsSessionUnref(self->priv->data_store_session); + self->priv->data_store_session = NULL; + } + if (self->priv->data_store) { + g_object_unref(self->priv->data_store); + self->priv->data_store = NULL; + } + if (self->priv->data_sync_session) { + g_object_unref(self->priv->data_sync_session); + self->priv->data_sync_session = NULL; + } + + /* cleanup sync anchors */ + + if (self->priv->remote_next) + smlSafeCFree(&(self->priv->remote_next)); + if (self->priv->local_next) + smlSafeCFree(&(self->priv->local_next)); G_OBJECT_CLASS (sml_data_sync_data_store_session_parent_class)->finalize (object); } @@ -360,7 +375,7 @@ SmlStatus *status, void *userdata) { - smlTrace(TRACE_ENTRY, "%s(%p, %p, %s, %p)", __func__, dsession, status, userdata); + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, dsession, status, userdata); GError *error = NULL; smlAssert(userdata); @@ -393,7 +408,7 @@ SmlMapItem *item, void *userdata) { - smlTrace(TRACE_ENTRY, "%s(%p, %s, %s, %p)", __func__, dsession, item, userdata); + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, dsession, item, userdata); GError *error = NULL; SmlDataSyncDataStoreSession *self = userdata; Modified: trunk/libsyncml/data_sync_api/sml_data_sync_session.c ============================================================================== --- trunk/libsyncml/data_sync_api/sml_data_sync_session.c Thu Oct 1 16:09:51 2009 (r1296) +++ trunk/libsyncml/data_sync_api/sml_data_sync_session.c Thu Oct 1 16:12:12 2009 (r1297) @@ -115,6 +115,34 @@ g_hash_table_remove_all(self->priv->hash_dsdss2dsdss); g_hash_table_remove_all(self->priv->hash_ds2dsdss); g_hash_table_remove_all(self->priv->hash_dsds2dsdss); + g_hash_table_unref(self->priv->hash_dsdss2dsdss); + g_hash_table_unref(self->priv->hash_ds2dsdss); + g_hash_table_unref(self->priv->hash_dsds2dsdss); + self->priv->hash_dsdss2dsdss = NULL; + self->priv->hash_ds2dsdss = NULL; + self->priv->hash_dsds2dsdss = NULL; + + /* cleanup remote DevInf */ + if (self->priv->remote_dev_inf) { + g_object_unref(self->priv->remote_dev_inf); + self->priv->remote_dev_inf = NULL; + } + + /* cleanup locations */ + if (self->priv->remote) { + g_object_unref(self->priv->remote); + self->priv->remote = NULL; + } + if (self->priv->local) { + g_object_unref(self->priv->local); + self->priv->local = NULL; + } + + /* cleanup data sync object */ + if (self->priv->data_sync) { + g_object_unref(self->priv->data_sync); + self->priv->data_sync = NULL; + } G_OBJECT_CLASS (sml_data_sync_session_parent_class)->finalize (object); } |