QWidget::closeEvent is called twice (it doesn't matter if the event is accepted or not).
See attached minimal application.
This regression was marked as fixed in
QTBUG-39398, but for me it is not.
I have Qt 5.4 statically build on osx, the patch is there, but i still can reproduce the issue using the test app in
i have fixed it for myself locally by not calling canQuit and calling QGuiApplication::exit(0) only if all windows did accept their close (and closed).