diff --git a/ChangeLog b/ChangeLog index 3f6512387..04c3bb61b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2011-08-12 Wolfgang Sourdeau + * OpenChange/MAPIStoreSOGo.m (sogo_table_handle_destructor): added + new backend operation. + * OpenChange/NSAutoreleasePool+MAPIStore: removed module since it was a lot of code to handle one specific case. diff --git a/OpenChange/MAPIStoreSOGo.m b/OpenChange/MAPIStoreSOGo.m index cda154e9a..b54cdc872 100644 --- a/OpenChange/MAPIStoreSOGo.m +++ b/OpenChange/MAPIStoreSOGo.m @@ -906,6 +906,31 @@ sogo_table_get_row_count (void *table_object, return rc; } +static int +sogo_table_handle_destructor (void *table_object, uint32_t handle_id) +{ + struct MAPIStoreTallocWrapper *wrapper; + NSAutoreleasePool *pool; + MAPIStoreTable *table; + + DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__)); + + if (table_object) + { + wrapper = table_object; + table = wrapper->MAPIStoreSOGoObject; + pool = [NSAutoreleasePool new]; + [table destroyHandle: handle_id]; + [pool release]; + } + else + { + NSLog (@" UNEXPECTED WEIRDNESS: RECEIVED NO DATA"); + } + + return MAPISTORE_SUCCESS; +} + static int sogo_properties_get_available_properties(void *object, TALLOC_CTX *mem_ctx, struct SPropTagArray **propertiesP) @@ -1040,6 +1065,7 @@ int mapistore_init_backend(void) backend.table.set_columns = sogo_table_set_columns; backend.table.get_row = sogo_table_get_row; backend.table.get_row_count = sogo_table_get_row_count; + backend.table.handle_destructor = sogo_table_handle_destructor; backend.properties.get_available_properties = sogo_properties_get_available_properties; backend.properties.get_properties = sogo_properties_get_properties; backend.properties.set_properties = sogo_properties_set_properties; diff --git a/OpenChange/MAPIStoreTable.h b/OpenChange/MAPIStoreTable.h index 941d835af..43314d313 100644 --- a/OpenChange/MAPIStoreTable.h +++ b/OpenChange/MAPIStoreTable.h @@ -78,6 +78,7 @@ typedef enum { - (uint8_t) tableType; - (void) setHandleId: (uint32_t) newHandleId; +- (void) destroyHandle: (uint32_t) handleId; - (id) childAtRowID: (uint32_t) rowId forQueryType: (enum table_query_type) queryType; diff --git a/OpenChange/MAPIStoreTable.m b/OpenChange/MAPIStoreTable.m index e878c335f..390a8697f 100644 --- a/OpenChange/MAPIStoreTable.m +++ b/OpenChange/MAPIStoreTable.m @@ -325,8 +325,6 @@ static Class NSDataK, NSStringK; [self logWithFormat: @"-dealloc"]; if (columns) NSZoneFree (NULL, columns); - if (container) - [[MAPIStoreActiveTables activeTables] unregisterTable: self]; [currentChild release]; [childKeys release]; [restrictedChildKeys release]; @@ -350,6 +348,12 @@ static Class NSDataK, NSStringK; handleId = newHandleId; } +- (void) destroyHandle: (uint32_t) tableHandleId +{ + if (handleId == tableHandleId) + [[MAPIStoreActiveTables activeTables] unregisterTable: self]; +} + - (void) cleanupCaches { [restrictedChildKeys release];