Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(606)

Unified Diff: webrtc/base/platform_thread.cc

Issue 2541003002: Make sure GetLastError on a PlatformThread return an error that is relevant to the thread. (Closed)
Patch Set: Add comment. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/platform_thread.cc
diff --git a/webrtc/base/platform_thread.cc b/webrtc/base/platform_thread.cc
index 286bee95f1299823920ec03175962dbf61e9cba8..0b025f2af048f94d9e776f171276850f54ef952e 100644
--- a/webrtc/base/platform_thread.cc
+++ b/webrtc/base/platform_thread.cc
@@ -119,6 +119,11 @@ PlatformThread::~PlatformThread() {
#if defined(WEBRTC_WIN)
DWORD WINAPI PlatformThread::StartThread(void* param) {
+ // The GetLastError() function only returns valid results when it is called
+ // after a Win32 API function that returns a "failed" result. A crash dump
+ // contains the result from GetLastError() and to make sure it does not
+ // falsely report a Windows error we call SetLastError here.
+ ::SetLastError(ERROR_SUCCESS);
static_cast<PlatformThread*>(param)->Run();
return 0;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698