Windows remember their own existence

how's that for metaphysical?

Windows register themselves at the class level. This means they don't go
out of scope until they are deleted.  A Delete callback removes the
window from the registry at deletion time.

Leveraging this strategy makes it easier to pop up dialogs without
worrying about keeping their roots in scope.