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

c++ api - remove get_removed_devices method from event_information class #2823

Merged

Conversation

matkatz
Copy link
Contributor

@matkatz matkatz commented Dec 2, 2018

Jira issue:
DS5DSO-10869 - OnDeviceChange provide a removed list which cause crash on enumeration

The current API allows the user to iterate the removed devices list as following:

    ctx.set_devices_changed_callback([&](rs2::event_information& info)
    {
        for (auto& d : info.get_removed_devices()) { }
    });

This code will always throw exception since iterating the list tries to create the devices in the list.
And since the device is not available, exception is thrown.

The correct way to check if a device was removed is:

    ctx.set_devices_changed_callback([&](rs2::event_information& info)
    {
        if (info.was_removed(my_device))
            handle_device_removale();
    });

@dorodnic
Copy link
Contributor

dorodnic commented Dec 2, 2018

Please add more information on the reason for this change

@dorodnic dorodnic merged commit 218a6fa into IntelRealSense:development Dec 4, 2018
@matkatz matkatz deleted the remove_get_removed_devices_api branch December 23, 2018 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants