Fix dismiss() causing crash when dialog is detached.
Fix dismiss() causing crash when dialog is detached.

Summary: If dismiss is called (especially on the spinner) after the dialog has been detached from the window, it could cause the whole app to crash. This alleviates that situation. App developers should still call dismiss() on the dialog during onPause() since this does not address the leaking window issue, but if they don't, this at least won't crash their app.

Test Plan: Tested various situations where rotation happens (during a webview load, and after posting an update).

Reviewers: mmarucheck, clang

Reviewed By: mmarucheck

Differential Revision: https://phabricator.fb.com/D643794

Task ID: 1878623

lizhi5753186/facebook-android-sdk,bitcellar-labs/facebook-android-sdk,scalio/facebook-android-sdk,satoshi-okawa/facebook-android-sdk-test1,TechSmith/facebook-android-sdk,Flutterbee/facebook-android-sdk,CristianOliveiraDaRosa/facebook-android-sdk,minhduc3404/facebookSdk,lizhi5753186/facebook-android-sdk,ribot/facebook-android-sdk,mindjolt/facebook-android-sdk,scalio/facebook-android-sdk,ribot/facebook-android-sdk,Limbika/facebook-android-sdk,quizlet/facebook-android-sdk,Limbika/facebook-android-sdk,taisukeoe/facebook-android-sdk,quizlet/facebook-android-sdk,mindjolt/facebook-android-sdk,minhduc3404/facebookSdk,PioneerLab/facebook-android-sdk,MKrishtop/facebook-android-sdk,taisukeoe/facebook-android-sdk,couchbaselabs/facebook-android-sdk,MKrishtop/facebook-android-sdk,PioneerLab/facebook-android-sdk,CristianOliveiraDaRosa/facebook-android-sdk,couchbaselabs/facebook-android-sdk,MarkHappy/Facebook_SDK,GrioSF/facebook-android-sdk,TimeIncOSS/facebook-android-sdk,RabbleApp/facebook-android-sdk,TechSmith/facebook-android-sdk,Flutterbee/facebook-android-sdk,RabbleApp/facebook-android-sdk,TimeIncOSS/facebook-android-sdk,satoshi-okawa/facebook-android-sdk-test1,MarkHappy/Facebook_SDK,GrioSF/facebook-android-sdk,bitcellar-labs/facebook-android-sdk