revid: made revid.Config() return copy of revid's config rather than pointer so that mutation isn't possible

This commit is contained in:
saxon 2019-01-13 19:15:02 +10:30
parent af6c8d875f
commit aa5d316816
1 changed files with 2 additions and 7 deletions

View File

@ -181,13 +181,8 @@ func (r *Revid) Bitrate() int {
} }
// Config returns the Revid's config. // Config returns the Revid's config.
func (r *Revid) Config() *Config { func (r *Revid) Config() Config {
// FIXME(kortschak): This is a massive footgun and should not exist. return r.config
// Since the config's fields are accessed in running goroutines, any
// mutation is a data race. With bad luck a data race is possible by
// reading the returned value since it is possible for the running
// Ravid to mutate the config it holds.
return &r.config
} }
// reset swaps the current config of a Revid with the passed // reset swaps the current config of a Revid with the passed