RPC: Fix input lockup on disconnect

This commit is contained in:
Willy-JL
2024-06-24 23:45:27 +02:00
parent 9e8be87fe6
commit f6c59a9e76
2 changed files with 17 additions and 0 deletions

View File

@@ -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)

View File

@@ -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);