From d29cb0a15d3c036c5aeb8f1bcc730d8630f80388 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 1 Oct 2024 15:03:01 +0200 Subject: [PATCH] Gui::Connection::buffer: fix upgrade loop Once set to true, the 'retry' flag would never be reset to false. Issue #5242 --- repos/os/include/gui_session/connection.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/repos/os/include/gui_session/connection.h b/repos/os/include/gui_session/connection.h index 739aa26e5e..1167cb05e1 100644 --- a/repos/os/include/gui_session/connection.h +++ b/repos/os/include/gui_session/connection.h @@ -164,13 +164,12 @@ class Gui::Connection : private Genode::Connection _ram_quota.value += upgrade; } - for (bool retry = false; ; ) { + for (;;) { using Result = Session_client::Buffer_result; auto const result = _client.buffer(mode); - if (result == Result::OUT_OF_RAM) { upgrade_ram(8*1024); retry = true; } - if (result == Result::OUT_OF_CAPS) { upgrade_caps(2); retry = true; } - if (!retry) - break; + if (result == Result::OUT_OF_RAM) { upgrade_ram(8*1024); continue; } + if (result == Result::OUT_OF_CAPS) { upgrade_caps(2); continue; } + break; } }