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

server: Don't swallow errors in register_device_collection_changed. #71

Merged
merged 2 commits into from Jul 29, 2019

Conversation

kinetiknz
Copy link
Contributor

Swallowing errors (by converting them to panics via expect) in CubebDeviceCollectionManager::internal_register is a bad idea: registration can fail for legitimate reasons plus we need to report CUBEB_ERROR_NOT_SUPPORTED correctly for unimplemented backends.

This fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1569460

r? @ChunMinChang please

Copy link
Member

@ChunMinChang ChunMinChang left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

(true, false) => self.internal_register(context, dir, true),
(false, true) => self.internal_register(context, dir, false),
(true, false) => self.internal_register(context, dir, true)?,
(false, true) => self.internal_register(context, dir, false)?,
Copy link
Member

Choose a reason for hiding this comment

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

for &dir in &[cubeb::DeviceType::INPUT, cubeb::DeviceType::OUTPUT] {
    if devtype.contains(dir) != self.devtype.contains(dir) {
        self.internal_register(context, dir, devtype.contains(dir))?;
    }
}

will be shorter

@kinetiknz kinetiknz merged commit f6f56c4 into master Jul 29, 2019
@kinetiknz kinetiknz deleted the bug1569460 branch July 29, 2019 22:52
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

Successfully merging this pull request may close these issues.

None yet

2 participants