Skip to content

Commit

Permalink
Actually wait for animation unload (semaphore did not)
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Apr 4, 2024
1 parent f9d25fa commit f89f775
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions applications/services/desktop/desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ static void desktop_loader_callback(const void* message, void* context) {
const LoaderEvent* event = message;

if(event->type == LoaderEventTypeApplicationStarted) {
desktop->animation_lock = api_lock_alloc_locked();
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalBeforeAppStarted);
furi_check(furi_semaphore_acquire(desktop->animation_semaphore, 3000) == FuriStatusOk);
api_lock_wait_unlock_and_free(desktop->animation_lock);
desktop->animation_lock = NULL;
} else if(event->type == LoaderEventTypeApplicationStopped) {
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalAfterAppFinished);
}
Expand Down Expand Up @@ -121,7 +123,7 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) {
animation_manager_unload_and_stall_animation(desktop->animation_manager);
}
desktop_auto_lock_inhibit(desktop);
furi_semaphore_release(desktop->animation_semaphore);
api_lock_unlock(desktop->animation_lock);
return true;
case DesktopGlobalAfterAppFinished:
animation_manager_load_and_continue_animation(desktop->animation_manager);
Expand Down Expand Up @@ -278,7 +280,6 @@ void desktop_set_stealth_mode_state(Desktop* desktop, bool enabled) {
Desktop* desktop_alloc(void) {
Desktop* desktop = malloc(sizeof(Desktop));

desktop->animation_semaphore = furi_semaphore_alloc(1, 0);
desktop->animation_manager = animation_manager_alloc();
desktop->gui = furi_record_open(RECORD_GUI);
desktop->scene_thread = furi_thread_alloc();
Expand Down
2 changes: 1 addition & 1 deletion applications/services/desktop/desktop_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct Desktop {

bool in_transition : 1;

FuriSemaphore* animation_semaphore;
FuriApiLock animation_lock;

Keybinds keybinds;

Expand Down

0 comments on commit f89f775

Please sign in to comment.