419140 Fix use-after-free in the resource server
Sometimes (under Windows), the main window (and the palette docker)
gets destroyed before the palettes' resource server. Since the docker
does not remove itself as an observer in its destructor, the resource
server will do it on destruction -- thus trying to access a long dead
object.
It is interesting to see that this use-after-free happens:
- 100% reliably on Windows only
- and, to the best of my knowledge, with debug builds.
BUG: 419140
CCMAIL: kimageshop@kde.org
(cherry picked from commit 4cf116cbe65901146edc4c0de5a6d62a89c41172)