Merge "Fix crash caused by opening dialogs with a dead activity"