diff --git a/ChangeLog.md b/ChangeLog.md index af0005ae5..bb7ab9be6 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -56,6 +56,7 @@ - Archive: Fix favorite's parent folders thinking they are favorited too (by @Willy-JL) - FBT: Consistent version/branch info, fix gitorigin (by @Willy-JL) - AssetPacker: Pack pre-compiled icons and fonts too (by @Willy-JL) +- OFW: RPC: Fix input lockup on disconnect (by @Willy-JL) - OFW: ELF/Flipper application: Do not crash on "out of memory" (by @DrZlo13) - OFW: JS: Disable logging in mjs +2k free flash (by @hedger) - OFW: NFC: Fixed infinite loop in dictionary attack scene (by @RebornedBrain) diff --git a/applications/services/rpc/rpc_gui.c b/applications/services/rpc/rpc_gui.c index 319abefe3..d5d84c547 100644 --- a/applications/services/rpc/rpc_gui.c +++ b/applications/services/rpc/rpc_gui.c @@ -477,6 +477,22 @@ void rpc_system_gui_free(void* context) { RpcGuiSystem* rpc_gui = context; furi_assert(rpc_gui->gui); + // Release ongoing inputs to avoid lockup + for(InputKey key = 0; key < InputKeyMAX; key++) { + if(rpc_gui->input_key_counter[key] != RPC_GUI_INPUT_RESET) { + InputEvent event = { + .key = key, + .type = InputTypeRelease, + .sequence_source = INPUT_SEQUENCE_SOURCE_SOFTWARE, + .sequence_counter = rpc_gui->input_key_counter[key], + }; + FuriPubSub* input_events = furi_record_open(RECORD_INPUT_EVENTS); + furi_check(input_events); + furi_pubsub_publish(input_events, &event); + furi_record_close(RECORD_INPUT_EVENTS); + } + } + if(rpc_gui->virtual_display_view_port) { gui_remove_view_port(rpc_gui->gui, rpc_gui->virtual_display_view_port); view_port_free(rpc_gui->virtual_display_view_port);