From 552329423cd67e790412901a7e519c1dc58d9c1e Mon Sep 17 00:00:00 2001
From: Michal Pawluk
+ When the application is terminated, then the __terminate_app() callback function is called (see the code snippet below). +
+ ++static void __terminate_app(void *data) +{ + appdata_s *ad = (appdata_s *)data; + + controller_finit(&ad->view); +} ++ +
+ All the resources, allocated previously, are released with controller_finit() function, which is responsible for destroying the UI + and detaching events handlers. +
+ ++void controller_finit(viewdata_s *vd) +{ + view_destroy_base_gui(vd); + __remove_event_handlers(); +} ++ +
+ As the UI is not a subject for this documentation, the implementation of the view_destroy_base_gui() function is ommited. + Detaching events handlers relies on model_remove_event_handler() function for each attached event handler. For implementation + details see the Model section. +
+ ++static void __remove_event_handlers(void) +{ + model_remove_event_handler(APP_EVENT_LOW_BATTERY); + model_remove_event_handler(APP_EVENT_LOW_MEMORY); + model_remove_event_handler(APP_EVENT_DEVICE_ORIENTATION_CHANGED); + model_remove_event_handler(APP_EVENT_LANGUAGE_CHANGED); + model_remove_event_handler(APP_EVENT_REGION_FORMAT_CHANGED); + model_remove_event_handler(APP_EVENT_SUSPENDED_STATE_CHANGED); +} ++