Procházet zdrojové kódy

Fix Frozen upon exiting the apps.

Esteban Fuentealba před 1 rokem
rodič
revize
896bc54fb0
2 změnil soubory, kde provedl 16 přidání a 13 odebrání
  1. 11 9
      gba_cartridge_app.c
  2. 5 4
      uart.c

+ 11 - 9
gba_cartridge_app.c

@@ -70,27 +70,29 @@ GBACartridge* gba_cartridge_app_app_alloc() {
 
 void gba_cartridge_app_app_free(GBACartridge* app) {
     furi_assert(app);
-    // Scene manager
-    scene_manager_free(app->scene_manager);
-
-    // View Dispatcher
+    // Views
     view_dispatcher_remove_view(app->view_dispatcher, GBACartridgeViewIdMenu);
     view_dispatcher_remove_view(app->view_dispatcher, GBACartridgeViewIdScene1);
+    view_dispatcher_remove_view(app->view_dispatcher, GBACartridgeViewIdStartscreen);
     variable_item_list_free(app->submenu);
 
+    // View Dispatcher
     view_dispatcher_free(app->view_dispatcher);
+     // Scene manager
+    scene_manager_free(app->scene_manager);
+
+     //
+    uart_free(app->uart);
+    uart_free(app->lp_uart);
+
     furi_record_close(RECORD_GUI);
     furi_record_close(RECORD_STORAGE);
+    furi_record_close(RECORD_DIALOGS);
 
     app->gui = NULL;
     app->notification = NULL;
     app->storage = NULL;
 
-    //
-    uart_free(app->uart);
-    uart_free(app->lp_uart);
-    // Close File Browser
-    furi_record_close(RECORD_DIALOGS);
     furi_string_free(app->file_path);
 
     //Remove whatever is left

+ 5 - 4
uart.c

@@ -47,7 +47,7 @@ static void
     Uart* uart = (Uart*)context;
     UNUSED(handle);
 
-    if(event & (FuriHalSerialRxEventData | FuriHalSerialRxEventIdle)) {
+    if(event == FuriHalSerialRxEventData) {
         uint8_t data = furi_hal_serial_async_rx(handle);
         furi_stream_buffer_send(uart->rx_stream, &data, 1, 0);
         furi_thread_flags_set(furi_thread_get_id(uart->rx_thread), WorkerEvtRxDone);
@@ -183,12 +183,13 @@ Uart* lp_uart_init(void* app) {
 void uart_free(Uart* uart) {
     furi_assert(uart);
 
+    furi_hal_serial_async_rx_stop(uart->serial_handle);
+    furi_hal_serial_deinit(uart->serial_handle);
+    furi_hal_serial_control_release(uart->serial_handle);
+
     furi_thread_flags_set(furi_thread_get_id(uart->rx_thread), WorkerEvtStop);
     furi_thread_join(uart->rx_thread);
     furi_thread_free(uart->rx_thread);
 
-    furi_hal_serial_deinit(uart->serial_handle);
-    furi_hal_serial_control_release(uart->serial_handle);
-
     free(uart);
 }