settings_ui: Defer `fetch_files` to avoid reentrant lease of `Project` (#50488) (cherry-pick to stable) (#50741)

zed-zippy[bot] and Cole Miller created

Cherry-pick of #50488 to stable

----
Closes ZED-5CA

Release Notes:

- Fixed a crash when opening the settings UI.

Co-authored-by: Cole Miller <cole@zed.dev>

Change summary

crates/settings_ui/src/settings_ui.rs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Detailed changes

crates/settings_ui/src/settings_ui.rs 🔗

@@ -1574,8 +1574,10 @@ impl SettingsWindow {
                 };
 
                 this_weak
-                    .update(cx, |this, cx| {
-                        this.fetch_files(window, cx);
+                    .update(cx, |_, cx| {
+                        cx.defer_in(window, |settings_window, window, cx| {
+                            settings_window.fetch_files(window, cx)
+                        });
                         cx.observe_release_in(&project, window, |_, _, window, cx| {
                             cx.defer_in(window, |this, window, cx| this.fetch_files(window, cx));
                         })