I figured out that I was not passing the parent window when constructing the dialog1 instance. After that it works fine.