Fixed a bug which led to crash if notification dialog was trying to appear from background threads when user switched away from the application.