-
Notifications
You must be signed in to change notification settings - Fork 177
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
Backport2/v5.12 #1335
Changes from all commits
158606a
2a05b04
21fc539
e881858
dfa43c4
c72cd52
0b43311
6074b42
2cdcd69
def07b8
20b9124
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -76,6 +76,8 @@ namespace eCAL | |||||
{ | ||||||
} | ||||||
|
||||||
virtual ~CMsgSubscriber() = default; | ||||||
|
||||||
/** | ||||||
* @brief Copy Constructor is not available. | ||||||
**/ | ||||||
|
@@ -125,8 +127,6 @@ namespace eCAL | |||||
return *this; | ||||||
} | ||||||
|
||||||
virtual ~CMsgSubscriber() {} | ||||||
|
||||||
/** | ||||||
* @brief Creates this object. | ||||||
* | ||||||
|
@@ -207,7 +207,10 @@ namespace eCAL | |||||
assert(IsCreated()); | ||||||
RemReceiveCallback(); | ||||||
|
||||||
m_cb_callback = callback_; | ||||||
{ | ||||||
std::lock_guard<std::mutex> callback_lock(m_cb_callback_mutex); | ||||||
m_cb_callback = callback_; | ||||||
} | ||||||
auto callback = std::bind(&CMsgSubscriber::ReceiveCallback, this, std::placeholders::_1, std::placeholders::_2); | ||||||
return(CSubscriber::AddReceiveCallback(callback)); | ||||||
} | ||||||
|
@@ -219,9 +222,12 @@ namespace eCAL | |||||
**/ | ||||||
bool RemReceiveCallback() | ||||||
{ | ||||||
bool ret = CSubscriber::RemReceiveCallback(); | ||||||
|
||||||
std::lock_guard<std::mutex> callback_lock(m_cb_callback_mutex); | ||||||
if (m_cb_callback == nullptr) return(false); | ||||||
m_cb_callback = nullptr; | ||||||
return(CSubscriber::RemReceiveCallback()); | ||||||
return(ret); | ||||||
} | ||||||
|
||||||
protected: | ||||||
|
@@ -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; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable 'fn_callback' is not initialized [cppcoreguidelines-init-variables]
Suggested change
|
||||||
{ | ||||||
std::lock_guard<std::mutex> callback_lock(m_cb_callback_mutex); | ||||||
fn_callback = m_cb_callback; | ||||||
} | ||||||
|
||||||
if(fn_callback == nullptr) return; | ||||||
|
||||||
|
@@ -256,6 +266,7 @@ namespace eCAL | |||||
} | ||||||
} | ||||||
|
||||||
std::mutex m_cb_callback_mutex; | ||||||
MsgReceiveCallbackT m_cb_callback; | ||||||
}; | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,11 @@ namespace eCAL | |
#endif //ECAL_NPCAP_SUPPORT | ||
} | ||
|
||
CUDPReceiver::~CUDPReceiver() | ||
{ | ||
Destroy(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 contextecal/core/src/io/udp_receiver.cpp:58: Call to virtual method 'CUDPReceiver::Destroy' during destruction bypasses virtual dispatch Destroy();
^ |
||
} | ||
|
||
bool CUDPReceiver::Create(const SReceiverAttr& attr_) | ||
{ | ||
if (m_socket_impl) return false; | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -35,6 +35,12 @@ namespace eCAL | |||||
{ | ||||||
public: | ||||||
CUDPReceiver(); | ||||||
~CUDPReceiver(); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(const CUDPReceiver&) = delete; | ||||||
CUDPReceiver& operator=(const CUDPReceiver&) = delete; | ||||||
CUDPReceiver(CUDPReceiver&& rhs) = delete; | ||||||
CUDPReceiver& operator=(CUDPReceiver&& rhs) = delete; | ||||||
|
||||||
bool Create(const SReceiverAttr& attr_) override; | ||||||
bool Destroy() override; | ||||||
|
There was a problem hiding this comment.
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]