Skip to content

Don't store references to cuttlefish::CuttlefishConfig::InstanceSpecific#2543

Open
jemoreira wants to merge 1 commit intogoogle:mainfrom
jemoreira:noref
Open

Don't store references to cuttlefish::CuttlefishConfig::InstanceSpecific#2543
jemoreira wants to merge 1 commit intogoogle:mainfrom
jemoreira:noref

Conversation

@jemoreira
Copy link
Copy Markdown
Member

@jemoreira jemoreira commented May 9, 2026

The instance specific class only holds a pointer to the global config object and its own name, so they are very cheap to copy.

This objects are usually created by calling
cuttlefish::CuttlefishConfig::Instances which creates ephemeral instances of InstanceSpecific.

Most cases addressed by this PR are "safe" because the InstanceSpecific object being referenced is created in run_cvd's main loop which doesn't return and therefore the objects never go out of scope. Other cases were addressed by
#2541.

Bug: b/511301172

The instance specific class only holds a pointer to the global config
object and its own name, so they are very cheap to copy.

This objects are usually created by calling
`cuttlefish::CuttlefishConfig::Instances` which creates ephemeral
instances of `InstanceSpecific`.

Most cases addressed by this PR are "safe" because the
`InstanceSpecific` object being referenced is created in run_cvd's main
loop which doesn't return and therefore the objects never go out of
scope. Other cases were addressed by
google#2541.
@jemoreira jemoreira requested a review from Databean May 9, 2026 01:09
@jemoreira jemoreira enabled auto-merge May 9, 2026 01:10
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.

1 participant