From 81808d93c9fa122c4b3dd9ab1a6a934869937320 Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Tue, 30 Jan 2024 14:06:16 +0000 Subject: [PATCH] Ensure we prevent messages that were prevented when call_next was originally called (#4078) --- src/textual/message_pump.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/textual/message_pump.py b/src/textual/message_pump.py index 9605d3856d..b0dc922f58 100644 --- a/src/textual/message_pump.py +++ b/src/textual/message_pump.py @@ -592,7 +592,8 @@ async def _flush_next_callbacks(self) -> None: self._next_callbacks.clear() for callback in callbacks: try: - await self._dispatch_message(callback) + with self.prevent(*callback._prevent): + await invoke(callback.callback) except Exception as error: self.app._handle_exception(error) break