[sr-dev] git:3.1: dialog: safer unref of terminated dialogs