Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport2/v5.12 #1335

Merged
merged 11 commits into from
Jan 26, 2024
Merged

Backport2/v5.12 #1335

merged 11 commits into from
Jan 26, 2024

Conversation

KerstinKeller
Copy link
Contributor

@KerstinKeller KerstinKeller commented Jan 25, 2024

Backport of commits 18.01.24 - 25.01.24

KerstinKeller and others added 10 commits January 25, 2024 14:52
…apply_sample threadsafe.

Co-authored-by: Rex Schilasky <[email protected]>
…er (#1316)

Probably cherry pick to 5.11 / 5.12.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Properly implement destructor (in inherited classes)! -> Destroy may not be called in base CMsgSubscriber class as this can lead to stack unwinding (most likely causes an exception in destructor, or leads to already deleted functions of derived class being called when they are already deleted)
- Correct order of RemReceiveCallback and resetting internal pointer
- protect function pointer with mutex.
- Make testcase "harder" to more easily trigger race conditions.
This PR protects the m_payload member variable and thus makes the Send() function reentrant, as it may be called simultaneously from different threads.

Co-authored-by: Florian Reimold <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -219,9 +222,12 @@ namespace eCAL
**/
bool RemReceiveCallback()
{
bool ret = CSubscriber::RemReceiveCallback();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ret' is not initialized [cppcoreguidelines-init-variables]

Suggested change
bool ret = CSubscriber::RemReceiveCallback();
bool ret = 0 = CSubscriber::RemReceiveCallback();

@@ -245,7 +251,11 @@ namespace eCAL
private:
void ReceiveCallback(const char* topic_name_, const struct eCAL::SReceiveCallbackData* data_)
{
MsgReceiveCallbackT fn_callback(m_cb_callback);
MsgReceiveCallbackT fn_callback = nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'fn_callback' is not initialized [cppcoreguidelines-init-variables]

Suggested change
MsgReceiveCallbackT fn_callback = nullptr;
MsgReceiveCallbackT fn_callback = 0 = nullptr;

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -54,6 +54,11 @@ namespace eCAL
#endif //ECAL_NPCAP_SUPPORT
}

CUDPReceiver::~CUDPReceiver()
{
Destroy();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Call to virtual method 'CUDPReceiver::Destroy' during destruction bypasses virtual dispatch [clang-analyzer-optin.cplusplus.VirtualCall]

    Destroy();
    ^
Additional context

ecal/core/src/io/udp_receiver.cpp:58: Call to virtual method 'CUDPReceiver::Destroy' during destruction bypasses virtual dispatch

    Destroy();
    ^

@@ -35,6 +35,12 @@ namespace eCAL
{
public:
CUDPReceiver();
~CUDPReceiver();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: annotate this function with 'override' or (rarely) 'final' [cppcoreguidelines-explicit-virtual-functions]

Suggested change
~CUDPReceiver();
~CUDPReceiver() override;

@FlorianReimold FlorianReimold merged commit 54934df into support/v5.12 Jan 26, 2024
9 checks passed
@KerstinKeller KerstinKeller deleted the backport2/v5.12 branch February 2, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants