@@ -87,6 +87,7 @@ typedef struct metis_lru_contentstore_data {
8787} _MetisLRUContentStore ;
8888
8989
90+
9091static void
9192_destroyIndexes (_MetisLRUContentStore * store )
9293{
@@ -117,16 +118,31 @@ _destroyIndexes(_MetisLRUContentStore *store)
117118}
118119
119120static void
120- _destroy (MetisContentStoreInterface * * storeImplPtr )
121+ _MetisContentStoreInterface_Destroy (MetisContentStoreInterface * * storeImplPtr )
121122{
122123 _MetisLRUContentStore * store = metisContentStoreInterface_GetPrivateData (* storeImplPtr );
123124
124- _destroyIndexes (store );
125+ // _destroyIndexes(store);
126+ parcObject_Release ((PARCObject * * ) & store );
127+ }
125128
129+ static bool
130+ _MetisLRUContentStore_Destructor (_MetisLRUContentStore * * storePtr )
131+ {
132+ _MetisLRUContentStore * store = * storePtr ;
133+
134+ _destroyIndexes (store );
126135 metisLogger_Release (& store -> logger );
136+
137+ return true;
127138}
128139
129- parcObject_ExtendPARCObject (MetisContentStoreInterface , _destroy , NULL , NULL , NULL , NULL , NULL , NULL );
140+ parcObject_Override (_MetisLRUContentStore , PARCObject ,
141+ .destructor = (PARCObjectDestructor * ) _MetisLRUContentStore_Destructor
142+ );
143+
144+ parcObject_ExtendPARCObject (MetisContentStoreInterface ,
145+ _MetisContentStoreInterface_Destroy , NULL , NULL , NULL , NULL , NULL , NULL );
130146
131147static parcObject_ImplementAcquire (_metisLRUContentStore , MetisContentStoreInterface ) ;
132148static parcObject_ImplementRelease (_metisLRUContentStore , MetisContentStoreInterface ) ;
@@ -499,12 +515,14 @@ metisLRUContentStore_Create(MetisContentStoreConfig *config, MetisLogger *logger
499515
500516 assertNotNull (logger , "MetisLRUContentStore requires a non-NULL logger" );
501517
502- size_t allocationSize = sizeof (MetisContentStoreInterface ) + sizeof (_MetisLRUContentStore );
518+ // size_t allocationSize = sizeof(MetisContentStoreInterface) + sizeof(_MetisLRUContentStore);
503519
504- storeImpl = parcObject_CreateAndClearInstanceImpl (allocationSize , & parcObject_MetaName (MetisContentStoreInterface ));
520+ // storeImpl = parcObject_CreateAndClearInstanceImpl(allocationSize, &parcObject_MetaName(MetisContentStoreInterface));
521+ storeImpl = parcObject_CreateAndClearInstance (MetisContentStoreInterface );
505522
506523 if (storeImpl != NULL ) {
507- storeImpl -> _privateData = (uint8_t * ) storeImpl + sizeof (MetisContentStoreInterface );
524+ // storeImpl->_privateData = (uint8_t *) storeImpl + sizeof(MetisContentStoreInterface);
525+ storeImpl -> _privateData = parcObject_CreateAndClearInstance (_MetisLRUContentStore );
508526
509527 if (_metisLRUContentStore_Init (storeImpl -> _privateData , config , logger )) {
510528 storeImpl -> putContent = & _metisLRUContentStore_PutContent ;
0 commit comments