summaryrefslogtreecommitdiff
path: root/retrace
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2016-03-05 13:23:18 +0000
committerJose Fonseca <jfonseca@vmware.com>2016-03-05 13:26:05 +0000
commit2760cb5131ac795547fca09c841d539a8ded0fd0 (patch)
tree678e64a014aa6848c4d6bb2290d56f1b7967e720 /retrace
parentd3065ac08af44dc60c67e07cfe3a5d51aded7068 (diff)
ws: Call _exit on early termination.
Instead of exit, as it's not safe to call global destructors outside the main thread, while it's still running. Should fix https://github.com/apitrace/apitrace/issues/430
Diffstat (limited to 'retrace')
-rw-r--r--retrace/ws_win32.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/retrace/ws_win32.cpp b/retrace/ws_win32.cpp
index 819a129c..498679d5 100644
--- a/retrace/ws_win32.cpp
+++ b/retrace/ws_win32.cpp
@@ -56,7 +56,10 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
pMMI->ptMaxTrackSize.y = 60000;
break;
case WM_CLOSE:
- exit(0);
+ // This is run on a thread other than the main thread and the retrace
+ // threads, which are still alive and running, so we must bypass
+ // destructors here to avoid crashes.
+ _exit(EXIT_SUCCESS);
break;
default:
break;