I have the following threads:
2928 0 Main Thread name: Mirrord.exe!MirrorApp::Init Normal
5676 0 Worker Thread name: GdiPlus.dll!DllRefCountSafeThreadThunk() location: GdiPlus.dll!BackgroundThreadProc Normal
1556 0 Worker Thread name: msvcr110d.dll!_threadstartex location: allegro-5.0.8-monolith-md-debug.dll!501c453e Normal
5684 0 Worker Thread name: nvd3dum.dll thread location: nvd3dum.dll!67319d84 Above Normal
When the program ends, the 0x162c thread returns with code 1, that is the second thread 5676.
The problem is, the return code 0 stays up to the end. I mean, I step through the whole program up to the line __crtExitProcess(code); after which the program ends. And even there it shows "the program exited with code 1", when I step over the program ends with code 1. I can't step into this function itself thought I get thrown into assembly.
How is that even possible? Could it be some memory corruption?
I have no idea what else to enable, I think it should break at every exception.
I think I found a way to break at function by its name, and I added breakpoints on abort and exit functions, but it doest break on abort. It breaks on exit, though.
It seems that the application returns 1 when the last thread returns 1. If the last thread to end isn't this GDI thread, then I get return code 0.
Moreover, I just used this tutorial http://wiki.allegro.cc/index.php?title=Basic_tutorial_on_loading_and_showing_images and the GDI thread there also returns 1. However, the application itself returns what it is told to return.