## Context Since https://github.com/zed-industries/zed/pull/52232/, there have been a lot of problems related to panels randomly hiding and showing themselves. However, the code in that PR is pretty innocuous. It shouldn't be having that kind of effect. However, it turns out there's a bug in how GPUI subscriptions work that caused there to be orphaned observe callbacks firing spuriously. The core sequence is captured in `test_unsubscribe_during_callback_with_insert`, essentially you have to have two observers on the same item (`SettingsStore`, in this case), that both drop themselves. If the first observer _adds_ a callback onto the _same item_, then the second observer will never successfully drop itself. While in there, I also fixed an unrelated bug that @maxbrunsfeld noticed where if you have two callbacks on the same item, and an earlier callback drops a later one, then the second callback will spuriously fire. I also added a few extra smoke tests to the subscription code, and a test capturing the observed bug at the workspace level. ## Self-Review Checklist <!-- Check before requesting review: --> - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A --------- Co-authored-by: max <max@zed.dev>
2 files changedLine totals unavailable