From 6b357a6ae7efcbf317c36fc3ef5dbc7ed990f1f2 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 28 Apr 2021 14:16:03 -0600 Subject: [PATCH] Fix tests I didn't realize a previous change had broken stuff. We need to always call `remove_dropped_entities` and `update_windows` in `flush_effects`, even if there aren't any effects. To achieve this, I use a `loop` to ensure we call these methods at least once before breaking. --- gpui/src/app.rs | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/gpui/src/app.rs b/gpui/src/app.rs index 3e7b3cb4ad16d6c5d4cc40206b7e08539ef01710..c732475e8bf932cd6130c5431ecb75bd0843a66c 100644 --- a/gpui/src/app.rs +++ b/gpui/src/app.rs @@ -902,25 +902,30 @@ impl MutableAppContext { if !self.flushing_effects && self.pending_flushes == 0 { self.flushing_effects = true; - while let Some(effect) = self.pending_effects.pop_front() { - match effect { - Effect::Event { entity_id, payload } => self.emit_event(entity_id, payload), - Effect::ModelNotification { model_id } => self.notify_model_observers(model_id), - Effect::ViewNotification { window_id, view_id } => { - self.notify_view_observers(window_id, view_id) - } - Effect::Focus { window_id, view_id } => { - self.focus(window_id, view_id); + loop { + if let Some(effect) = self.pending_effects.pop_front() { + match effect { + Effect::Event { entity_id, payload } => self.emit_event(entity_id, payload), + Effect::ModelNotification { model_id } => { + self.notify_model_observers(model_id) + } + Effect::ViewNotification { window_id, view_id } => { + self.notify_view_observers(window_id, view_id) + } + Effect::Focus { window_id, view_id } => { + self.focus(window_id, view_id); + } } - } - - if self.pending_effects.is_empty() { + } else { self.remove_dropped_entities(); self.update_windows(); + + if self.pending_effects.is_empty() { + self.flushing_effects = false; + break; + } } } - - self.flushing_effects = false; } }