diff --git a/iceoryx_utils/source/posix_wrapper/message_queue.cpp b/iceoryx_utils/source/posix_wrapper/message_queue.cpp index 23ab4fb9d3..9585179fdf 100644 --- a/iceoryx_utils/source/posix_wrapper/message_queue.cpp +++ b/iceoryx_utils/source/posix_wrapper/message_queue.cpp @@ -158,6 +158,7 @@ cxx::expected MessageQueue::destroy() } m_mqDescriptor = INVALID_DESCRIPTOR; + m_isInitialized = false; return cxx::success(); } diff --git a/iceoryx_utils/source/posix_wrapper/unix_domain_socket.cpp b/iceoryx_utils/source/posix_wrapper/unix_domain_socket.cpp index 563ca2b019..a54a89ab52 100644 --- a/iceoryx_utils/source/posix_wrapper/unix_domain_socket.cpp +++ b/iceoryx_utils/source/posix_wrapper/unix_domain_socket.cpp @@ -85,6 +85,7 @@ UnixDomainSocket& UnixDomainSocket::operator=(UnixDomainSocket&& other) noexcept m_sockAddr = std::move(other.m_sockAddr); other.m_sockfd = INVALID_FD; m_maxMessageSize = std::move(other.m_maxMessageSize); + moveCreationPatternValues(std::move(other)); } return *this; @@ -128,6 +129,7 @@ cxx::expected UnixDomainSocket::destroy() noexcept } m_sockfd = INVALID_FD; + m_isInitialized = false; return cxx::success(); } diff --git a/iceoryx_utils/test/moduletests/test_message_queue.cpp b/iceoryx_utils/test/moduletests/test_message_queue.cpp index ba3b379423..2fe1e98358 100644 --- a/iceoryx_utils/test/moduletests/test_message_queue.cpp +++ b/iceoryx_utils/test/moduletests/test_message_queue.cpp @@ -214,6 +214,14 @@ TEST_F(MessageQueue_test, sendAndReceive) EXPECT_EQ(anotherMessage, *receivedMessage); } +TEST_F(MessageQueue_test, invalidAfterDestroy) +{ + client.destroy(); + ASSERT_FALSE(client.isInitialized()); + server.destroy(); + ASSERT_FALSE(server.isInitialized()); +} + TEST_F(MessageQueue_test, sendAfterClientDestroy) { auto dest = client.destroy();