Sfoglia il codice sorgente

debug memory leak. read after load still bug

zinongli 11 mesi fa
parent
commit
9a15af52a0

BIN
scenes/.DS_Store


+ 1 - 2
scenes/metroflip_scene_load.c

@@ -39,10 +39,9 @@ void metroflip_scene_load_on_enter(void* context) {
     if(app->data_loaded) {
         // Direct to the parsing screen just like the auto scene does
         app->card_type = furi_string_get_cstr(card_type);
-        FURI_LOG_I(TAG, "Card type: %s", app->card_type);
         scene_manager_next_scene(app->scene_manager, MetroflipSceneParse);
     } else {
-        scene_manager_next_scene(app->scene_manager, MetroflipSceneStart);
+        scene_manager_search_and_switch_to_previous_scene(app->scene_manager, MetroflipSceneStart);
     }
     furi_string_free(file_path);
     furi_record_close(RECORD_STORAGE);

+ 3 - 3
scenes/metroflip_scene_parse.c

@@ -53,12 +53,12 @@ bool metroflip_scene_parse_on_event(void* context, SceneManagerEvent event) {
 
 void metroflip_scene_parse_on_exit(void* context) {
     Metroflip* app = context;
-
-    if(!((app->card_type[0] == '\0') || (strcmp(app->card_type, "unknown") == 0) ||
-         (!app->card_type))) {
+    FURI_LOG_I(TAG, "Card type = %s", app->card_type);
+    if(!((app->card_type[0] == '\0') || (strcmp(app->card_type, "unknown") == 0) || (!app->card_type))) {
         // Get and run the plugin's on_exit function
         const MetroflipPlugin* plugin = plugin_manager_get_ep(app->plugin_manager, 0);
         plugin->plugin_on_exit(app);
+        FURI_LOG_I(TAG, "Parse scene exit");
 
         plugin_manager_free(app->plugin_manager);
         composite_api_resolver_free(app->resolver);

+ 3 - 3
scenes/plugins/suica.c

@@ -379,9 +379,7 @@ static NfcCommand suica_poller_callback(NfcGenericEvent event, void* context) {
             }
 
             if(model->size == 1 && felica_poller->data->pmm.data[1] != SUICA_IC_TYPE_CODE) {
-                furi_string_printf(
-                    parsed_data,
-                    "\e#Suica\nSorry, not a Suica.\n");
+                furi_string_printf(parsed_data, "\e#Suica\nSorry, not a Suica.\n");
             }
             widget_add_text_scroll_element(
                 widget, 0, 0, 128, 64, furi_string_get_cstr(parsed_data));
@@ -569,6 +567,7 @@ static bool suica_on_event(Metroflip* app, SceneManagerEvent event) {
 
 static void suica_on_exit(Metroflip* app) {
     widget_reset(app->widget);
+    view_free_model(app->suica_context->view_history);
     view_free(app->suica_context->view_history);
     view_dispatcher_remove_view(app->view_dispatcher, MetroflipViewCanvas);
     free(app->suica_context);
@@ -577,6 +576,7 @@ static void suica_on_exit(Metroflip* app) {
         nfc_poller_stop(app->poller);
         nfc_poller_free(app->poller);
     }
+    FURI_LOG_I(TAG, "Suica scene exit");
 }
 
 /* Actual implementation of app<>plugin interface */