diff mbox series

[1/3] uihelper: Fix exception when TaskStarted event handler breaks

Message ID 20261127174616.2269186-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series [1/3] uihelper: Fix exception when TaskStarted event handler breaks | expand

Commit Message

Richard Purdie Nov. 27, 2026, 5:46 p.m. UTC
If there is an exception in a TaskStarted event handler, we can get a
still get a TaskFailed event which will trigger a second exception. Since
our TaskStarted code may not have run. Avoid that second exception from
an undefined dict key.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/ui/uihelper.py | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/lib/bb/ui/uihelper.py b/lib/bb/ui/uihelper.py
index 3e077f04484..18079195ff5 100644
--- a/lib/bb/ui/uihelper.py
+++ b/lib/bb/ui/uihelper.py
@@ -25,6 +25,9 @@  class BBUIHelper:
         # PIDs are a bad idea as they can be reused before we process all UI events.
         # We maintain a 'fuzzy' match for TaskProgress since there is no other way to match
         def removetid(pid, tid):
+            if tid not in self.running_tasks:
+                # This is possible if you have an exception during a TaskStarted handler
+                return
             del self.running_tasks[tid]
             if self.pidmap[pid] == tid:
                 del self.pidmap[pid]