[DEV] correct signal destruction

This commit is contained in:
Edouard DUPIN 2016-02-20 12:58:54 +01:00
parent dd8296fd60
commit 0a4f400439
3 changed files with 18 additions and 3 deletions

View File

@ -28,6 +28,18 @@ void esignal::Interface::signalAdd(esignal::Base* _pointerOnSignal) {
m_list.push_back(_pointerOnSignal);
}
void esignal::Interface::signalRemove(esignal::Base* _pointerOnSignal) {
auto it = m_list.begin();
while (it != m_list.end()) {
if ( *it == nullptr
|| *it == _pointerOnSignal) {
it = m_list.erase(it);
} else {
++it;
}
}
}
std::vector<std::string> esignal::Interface::signalGetAll() const {
std::vector<std::string> out;
for (auto &it : m_list) {

View File

@ -28,10 +28,10 @@ namespace esignal {
/**
* @brief Register a parameter class pointer in the List of parameters
* @note This class does not destroy the parameter pointer!!!
* @param[in] pointerOnParameter Pointer on the parameter that might be added.
* @param[in] _pointerOnSignal Pointer on the signal that might be added.
*/
void signalAdd(esignal::Base* _pointerOnParameter);
void signalRemove(esignal::Base* _pointerOnParameter);
void signalAdd(esignal::Base* _pointerOnSignal);
void signalRemove(esignal::Base* _pointerOnSignal);
/**
* @brief Get All the signal list:
* @return vector on all the signals names

View File

@ -71,6 +71,9 @@ namespace esignal {
}
#endif
~LockSharedPtrRef() {
if (m_counter == nullptr) {
return;
}
int64_t count = m_counter->dec();
if (count > 0) {
return;