I may know the cause: when PSM is shutting down in "profile-before-change", we call nsNSSComponent::ShutdownNSS that calls ::NSS_Shutdown(). But, the nsNSSComponent service may not be released immediately after we do that and as there are many other observers processing "profile-before-change" after we shutdown nss, event loop may be triggered and one of the stacks I provide may get called after we have already shut nss down.
I may know the cause: when PSM is shutting down in "profile- before- change" , we call nsNSSComponent: :ShutdownNSS that calls ::NSS_Shutdown(). But, the nsNSSComponent service may not be released immediately after we do that and as there are many other observers processing "profile- before- change" after we shutdown nss, event loop may be triggered and one of the stacks I provide may get called after we have already shut nss down.
I'll provide a patch for this.