Modify the OPAL_LIST_RELEASE and OPAL_LIST_DESTRUCT macros to release the objects only when the list object is refcounted down to 1, which will then reach zero when destructed/released at the end of the macro
`
Этот коммит содержится в:
родитель
02cdd046bd
Коммит
a7045352e2
@ -168,22 +168,26 @@ typedef struct opal_list_t opal_list_t;
|
|||||||
*
|
*
|
||||||
* @param[in] list List to destruct or release
|
* @param[in] list List to destruct or release
|
||||||
*/
|
*/
|
||||||
#define OPAL_LIST_DESTRUCT(list) \
|
#define OPAL_LIST_DESTRUCT(list) \
|
||||||
do { \
|
do { \
|
||||||
opal_list_item_t *it; \
|
opal_list_item_t *it; \
|
||||||
while (NULL != (it = opal_list_remove_first(list))) { \
|
if (1 == ((opal_object_t*)(list))->obj_reference_count) { \
|
||||||
OBJ_RELEASE(it); \
|
while (NULL != (it = opal_list_remove_first(list))) { \
|
||||||
} \
|
OBJ_RELEASE(it); \
|
||||||
OBJ_DESTRUCT(list); \
|
} \
|
||||||
|
} \
|
||||||
|
OBJ_DESTRUCT(list); \
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
#define OPAL_LIST_RELEASE(list) \
|
#define OPAL_LIST_RELEASE(list) \
|
||||||
do { \
|
do { \
|
||||||
opal_list_item_t *it; \
|
opal_list_item_t *it; \
|
||||||
while (NULL != (it = opal_list_remove_first(list))) { \
|
if (1 == ((opal_object_t*)(list))->obj_reference_count) { \
|
||||||
OBJ_RELEASE(it); \
|
while (NULL != (it = opal_list_remove_first(list))) { \
|
||||||
} \
|
OBJ_RELEASE(it); \
|
||||||
OBJ_RELEASE(list); \
|
} \
|
||||||
|
} \
|
||||||
|
OBJ_RELEASE(list); \
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user