apart from using a global for no good reason, and using 'this' in a ctor.

Oh, and you delete a dialog that already has a parent -> double deletion will happen I think.

And it will get even worse if you instantiate two MainWindow...