You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(apps): look up controller by uuid in async pcmanager callbacks
The three pcmanager async callbacks (host_info_cb, send_wol_cb,
quitgame_cb) received the apps_fragment pointer through their
userdata, but the fragment can be destroyed while the worker
request is still in flight (WOL waits 30+s for the host; Quit
takes 1-5s; navigating away or forgetting the host destroys
the fragment in the meantime).
host_info_cb and send_wol_cb guarded with
"if (controller \!= current_instance) return", which avoids the
deref but still loads the freed pointer for the comparison —
technically UB and an ASan/UBSan trip wire. quitgame_cb had no
guard at all and went straight to controller->quit_progress and
controller->applist; if the fragment was gone, the deref crashed.
apploader's async callbacks don't have this issue because
apploader_destroy zeros its callback table before unref; pcmanager
has no equivalent invalidation hook.
Switch all three call sites to pass NULL as userdata and look the
fragment up via the static current_instance pointer + uuid match
in the callback. current_instance is written from on_view_created
and cleared in on_destroy_view (same LVGL/UI thread as the bus
delivery), so no cross-thread race. No memory is ever read through
the dangling userdata pointer.
0 commit comments