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

Memory access violation when remapping PDOs in master side #13

Open
xdaco opened this issue Jul 22, 2018 · 1 comment
Open

Memory access violation when remapping PDOs in master side #13

xdaco opened this issue Jul 22, 2018 · 1 comment

Comments

@xdaco
Copy link
Collaborator

xdaco commented Jul 22, 2018

Hi, I have been using this library to control CiA401 devices and I found a memory access violation issue if we try to remap pdo after a deleting old device and creating a new one. The issue was related to the residual add_pdo_received_callback entry. The workaround is to remove the residual add_pdo_received_callback while destroying a device.

Device::~Device() {
for (auto& cob_id : cob_ids_)
m_core.pdo.remove_pdo_received_callback(cob_id);
}

void PDO::remove_pdo_received_callback(uint16_t cob_id) {
std::lock_guardstd::mutex scoped_lock(m_receive_callbacks_mutex);
for (auto i = m_receive_callbacks.begin(); i != m_receive_callbacks.end();
i++)
if ((*i).cob_id == cob_id) {
m_receive_callbacks.erase(i);
break;
}
}

I am now trying to write a master side example which handles multiple slave device on the same bus. Any suggestion will really be appreciated.

@thk1
Copy link
Collaborator

thk1 commented Aug 9, 2018

Hi. Thanks for the report. Could you please create a pull request for this change?

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

No branches or pull requests

2 participants