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

Disallow copy-construction of Device objects. #7719

Merged
merged 1 commit into from
Jun 18, 2021

Conversation

bzbarsky-apple
Copy link
Contributor

The lifetime of these objects is entirely managed by DeviceController
and copy-constructing them does not make any sense.

Problem

If someone copies a Device, as @msandstedt noted, they can end up having it outlive the objects its members point to, and then bad things will happen.

Change overview

Disallow copying Device, because that's not a thing that makes sense.

Testing

Manual testing that attempting to copy fails. We don't really have a way to test "this should not compile" yet...

The lifetime of these objects is entirely managed by DeviceController
and copy-constructing them does not make any sense.
@woody-apple
Copy link
Contributor

@bzbarsky-apple bzbarsky-apple merged commit 01ee80e into project-chip:master Jun 18, 2021
@bzbarsky-apple bzbarsky-apple deleted the no-copy-device branch June 18, 2021 07:07
nikita-s-wrk pushed a commit to nikita-s-wrk/connectedhomeip that referenced this pull request Sep 23, 2021
The lifetime of these objects is entirely managed by DeviceController
and copy-constructing them does not make any sense.
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.

4 participants