From 8fbd087ba9599eee3f392fb9f066fd563ec4b55a Mon Sep 17 00:00:00 2001 From: Michael McGee Date: Sat, 9 Nov 2024 20:23:32 +0000 Subject: [PATCH] gui: fix rare crash --- src/disco/gui/fd_gui.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/disco/gui/fd_gui.c b/src/disco/gui/fd_gui.c index 421615ab0..476f59289 100644 --- a/src/disco/gui/fd_gui.c +++ b/src/disco/gui/fd_gui.c @@ -1402,10 +1402,15 @@ fd_gui_handle_optimistically_confirmed_slot( fd_gui_t * gui, for( ulong i=gui->summary.slot_optimistically_confirmed; i>=_slot; i-- ) { fd_gui_slot_t * slot = gui->slots[ i % FD_GUI_SLOTS_CNT ]; if( FD_UNLIKELY( slot->slot==ULONG_MAX ) ) break; - FD_TEST( slot->slot==i ); - slot->level = FD_GUI_SLOT_LEVEL_COMPLETED; - fd_gui_printf_slot( gui, i ); - fd_http_server_ws_broadcast( gui->http ); + if( FD_LIKELY( slot->slot==i ) ) { + /* It's possible for the optimistically confirmed slot to skip + backwards between two slots that we haven't yet replayed. In + that case we don't need to change anything, since they will + get marked properly when they get completed. */ + slot->level = FD_GUI_SLOT_LEVEL_COMPLETED; + fd_gui_printf_slot( gui, i ); + fd_http_server_ws_broadcast( gui->http ); + } } }