Skip to content
Browse files

Always copy config objects

If we mutate the value we get from the config, we want to make sure the value in
the config always stays the same (especially when it's the default!).
  • Loading branch information
The-Compiler committed Jul 4, 2017
1 parent 2c3981e commit e259293f83dc613e82983464ce5f85846bedfeb2
Showing with 4 additions and 1 deletion.
  1. +4 −1 qutebrowser/config/
@@ -412,7 +412,10 @@ def get_obj(self, name, *, mutable=True):
If mutable=True is set, watch the returned object for mutations.
opt = self.get_opt(name)
obj = self._values.get(name, opt.default)
# We always return a copy of the value stored internally, so the
# internal value can never be changed by mutating the object returned.
obj = copy.deepcopy(self._values.get(name, opt.default))
# Then we watch the returned object for changes.
if isinstance(obj, (dict, list)):
if mutable:
self._mutables.append((name, copy.deepcopy(obj), obj))

0 comments on commit e259293

Please sign in to comment.
You can’t perform that action at this time.