I only had a brief look at the example, it probably crashes because something else is closing your QDialog before you get to handle the dialog's response. But just looking at the code is not as helpful as simply running it through the debugger. So if you turn the code snippet into a compiling testcase (which still reproduces the crash) then I can help you.