I'm using the patched version of NameAndPassword as is here: https://github.com/skycocker/NameAndPassword
When using this outside of the login window (e.g. system.login.screensaver or my own test right), with only the NameAndPassword plug-in, the window hangs for about 10 seconds after pressing Ok or cancel.
Adding some logs, I see that MechanismDestroy is getting called on the plugin and NameAndPassword is released but it never gets to dealloc in NameAndPassword. I also don't see PluginDestroy getting called. The SecurityAgent hangs around for an additional 10 seconds after MechanismDestroy is called.
I saw this related post: SecurityAgentPlugin not working anymore on Yosemite (SFAuthorizationPluginView)
But following the accepted answer doesn't work and according to the Authorization Plug-in Reference didDeactivate shouldn't need to be called (there are no calls to RequestInterrupt and MechanismDeactivate is never called). Calling SetResult should be sufficient.
I can hack it by getting the window from the view and closing it forcibly but there must be a way to get it to work as intended.
I found different hack - I got the reference count of the auth-mechanism instance and release all but the last one. Do this after the setResult call. This solves the issue. It shouldn't be like that - but Apple doesn't give us much of a choice.