fix(libSceNpSnsFacebookDialog): keep a terminated dialog terminated during Open and Close #12893
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12893"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T13:31:34Z.
What
sceNpSnsFacebookDialogOpenandsceNpSnsFacebookDialogCloseread the dialog status, check it, and then storeFINISHEDin a separate step. If another thread callssceNpSnsFacebookDialogTerminatebetween the read and the store, Terminate returns 0 and sets the status toNONE, and then Open or Close overwrites it withFINISHED. Example: the dialog is initialized, thread A calls Open with a valid param while thread B calls Terminate. Both return 0, but afterwardssceNpSnsFacebookDialogGetStatusreturnsFINISHED(3) instead ofNONE(0), and the nextsceNpSnsFacebookDialogInitializefails withALREADY_INITIALIZED(0x80B80004). The library stays stuck looking initialized after it was terminated. Close has the same race.Open and Close now set
FINISHEDwith a compare-exchange loop that re-runs the checks on the value being replaced. A concurrent Terminate then either goes first, so the call returnsNOT_INITIALIZED, or goes after, so the status ends atNONE. Open still offers the PSN feature notice only after a successful transition. Single-threaded results are unchanged.Tested
Rebased onto
main1c8c0efc8c, Linux, Release, Ninja.guest_np_sns_facebook_dialoggets two new cases. Each runs 200000 rounds of Initialize, then Open (or Close) on the main thread racing Terminate on a second thread, and requires the status to beNONEafter each round. They run after the existingRequireNoticescase, which leaves the notice mode on Silent.cmake --build build --target libs guest_np_sns_facebook_dialog_tests -j32built.ctest --test-dir build -R '^guest_np_sns_facebook_dialog$' --repeat until-fail:50: 1/1 passed on all 50 runs.Export.cppfrom1c8c0efc8cand this PR's test kept, the test aborted on 10 of 11 runs.python3 tools/check_conventions.py --base 1c8c0efc8c41314402e6966da5bef6ea3d639d10: All conventions checks passed.git diff --check: clean.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)