# Put \`Theme\` behind an \`Arc\` \(\#3017\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/71c1e36d1e436631af212b593048a184d2122885)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 71c1e36d1e436631af212b593048a184d2122885

Requested commit: 71c1e36d1e436631af212b593048a184d2122885

Commit: 71c1e36d1e436631af212b593048a184d2122885

Tree: 17bf7bb3dcbc453c44f945d3a42e03fbb803b3cc

Author: Marshall Bowers

Committer: GitHub

## Message

```
Put `Theme` behind an `Arc` (#3017)

This PR puts the `Theme` returned from the `theme` function behind an
`Arc`.

### Motivation

While working on wiring up window focus events for the `TitleBar`
component we ran into issues where `theme` was holding an immutable
borrow to the `ViewContext` for the entirety of the `render` scope,
which prevented having mutable borrows in the same scope.

### Explanation

To avoid this, we can make `theme` return an `Arc<Theme>` to allow for
cheap clones and avoiding the issues with the borrow checker.

Release Notes:

- N/A

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
```

## Parents

- [d8c6adf338b746bc360c4990309bd63f905088d1](https://git.cafe/gitcafe/zed/commit/d8c6adf338b746bc360c4990309bd63f905088d1?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/71c1e36d1e436631af212b593048a184d2122885?format=markdown)
