Skip to content
This repository was archived by the owner on Jan 4, 2023. It is now read-only.

Conversation

@pierantoniomerlino
Copy link
Contributor

This PR tries to fix the issue #113.
A mutex and guard_locks are added in BluetoothManager to synchronize the access to the event_list.

I'm not a C++ expert, so please check it before merging!
Signed-off-by: pierantoniomerlino pierantonio.merlino@eurotech.com

Signed-off-by: pierantoniomerlino <pierantonio.merlino@eurotech.com>
void BluetoothManager::handle_event(BluetoothType type, std::string *name,
std::string *identifier, BluetoothObject *parent, BluetoothObject &object)
{
std::lock_guard<std::mutex> guard(lock);
Copy link

Choose a reason for hiding this comment

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

Hi.

Is it possible, that add_event/remove_event API will be called in scope of callback (line 232). If so, crash will occur because 'event_list' will be modified during the iteration. To avoid this copy on write semantics should be implemented.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant