There are only a few acceptable situations when it's ok to allocate a widget on the stack:
  • a top level window in main() (since QApp::exec() blocks)
  • a modal dialog anywhere (since its exec() blocks)
  • perhaps some other I didn't think of

Otherwise you should likely NEVER allocate a widget on the stack. This only causes problems because a QObject automatically deletes its children. This leads to a double free attempt; 1) by parent 2) when going out of scope => crash.