press the button cancel when the system asks me the name of the XPS file

At first I thought the error was in my application but I found that the same happens in QtCreator.
In my case the crash happens in the slot connected to the signal paintRequested() of my QPrintPreviewWidget subclass: