I don't want to deflect the button hit or ignore the close event. I just need to run some cleanup code.
Let me tell you what I've tried so far:
atexit()
_onexit()
SetConsoleCtrlHandler()
~QCoreApplication()
No code set by these is being executed. The process just get killed when I press the X.
I certainly can make a windowed app and solve this, but is there a solution for a console application?
Thanks!