Fix crash when clicking on dismiss, sometimes.
client->dismiss(this) ends up setting client to nullptr, so the disconnect() warns about null receiver and doesn't actually disconnect.
(This is similar to 24f3853f in master)
BUGS: 455472, 455369, 455886, 455258, 455583