diff --git a/TESTS/events/equeue/main.cpp b/TESTS/events/equeue/main.cpp index 98288859fbf..17edc3cc364 100644 --- a/TESTS/events/equeue/main.cpp +++ b/TESTS/events/equeue/main.cpp @@ -742,8 +742,8 @@ static void test_equeue_chain() TEST_ASSERT_EQUAL_UINT8(3, touched1); TEST_ASSERT_EQUAL_UINT8(3, touched2); - equeue_destroy(&q1); equeue_destroy(&q2); + equeue_destroy(&q1); } /** Test that unchaining equeues makes them work on their own. diff --git a/UNITTESTS/events/equeue/test_equeue.cpp b/UNITTESTS/events/equeue/test_equeue.cpp index cb93134b281..33eccca8155 100644 --- a/UNITTESTS/events/equeue/test_equeue.cpp +++ b/UNITTESTS/events/equeue/test_equeue.cpp @@ -765,8 +765,8 @@ TEST_F(TestEqueue, test_equeue_chain) EXPECT_EQ(3, touched1); EXPECT_EQ(3, touched2); - equeue_destroy(&q1); equeue_destroy(&q2); + equeue_destroy(&q1); } /** Test that unchaining equeues makes them work on their own. diff --git a/events/equeue.h b/events/equeue.h index 7c3dfbea54b..5d452fc5040 100644 --- a/events/equeue.h +++ b/events/equeue.h @@ -93,6 +93,9 @@ typedef struct equeue { // // If the event queue creation fails, equeue_create returns a negative, // platform-specific error code. +// +// If queues are chained, it is needed to unchain them first, before calling destroy, +// or call the destroy function on queues in order that chained queues are destroyed first. int equeue_create(equeue_t *queue, size_t size); int equeue_create_inplace(equeue_t *queue, size_t size, void *buffer); void equeue_destroy(equeue_t *queue); diff --git a/events/source/tests/tests.c b/events/source/tests/tests.c index d5c8e131008..6c4c22b6724 100644 --- a/events/source/tests/tests.c +++ b/events/source/tests/tests.c @@ -606,8 +606,8 @@ void chain_test(void) test_assert(touched == 6); - equeue_destroy(&q1); equeue_destroy(&q2); + equeue_destroy(&q1); } void unchain_test(void)