From 4de7f39c52a1a62dd9ce6d1cc4574670a7b84670 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 20 Apr 2021 10:12:12 +1200 Subject: [PATCH] avoid situation where overlays can be shown twice https://bugs.launchpad.net/subiquity/+bug/1925068 reports a crash that fails with the "self.global_overlays.remove(overlay)" in remove_global_overlay failing because the overlay is not in the list. I don't know how it happened but staring at the code I did guess one way this could happen: if you have two non-interactive screens in a row where the requests both take long enough to trip the 0.1s threshold to show the progress screen, app.ui.set_body will get called twice with the same view. Each call will layer all global overlays over the view, so doing it twice will show the views twice. This all makes me thing that the way global overlays are shown is a bit wrong -- they should be "outside" the controller-supplied view! -- but, well, it's easy enough to make sure that calling set_body twice with the same view doesn't cause this particular problem. --- subiquity/ui/frame.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subiquity/ui/frame.py b/subiquity/ui/frame.py index 8314f546e..798d917e7 100644 --- a/subiquity/ui/frame.py +++ b/subiquity/ui/frame.py @@ -36,6 +36,8 @@ def keypress(self, size, key): return super().keypress(size, key) def set_body(self, widget): + if widget is self.body: + return super().set_body(widget) if isinstance(widget, BaseView): for overlay in self.app.global_overlays: