summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-04 02:13:46 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-04 02:13:46 +0000
commitcb54251f28bcf5eb249e19af85d01480f2dde1cf (patch)
treef66c557e66b1bb084617264b95a08a22bd2b793c /net
parent4035a150e22bf51631b09fc810002d859aea1565 (diff)
downloadchromium_src-cb54251f28bcf5eb249e19af85d01480f2dde1cf.zip
chromium_src-cb54251f28bcf5eb249e19af85d01480f2dde1cf.tar.gz
chromium_src-cb54251f28bcf5eb249e19af85d01480f2dde1cf.tar.bz2
Delete WSACleanup() call in the network stack.
This should prevent us from crashing in getaddrinfo() in shutdown after Winsock has already been deleted, since we'll always hold onto a reference. BUG=42117 Review URL: http://codereview.chromium.org/1888002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46319 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/winsock_init.cc13
-rw-r--r--net/base/winsock_init.h4
2 files changed, 6 insertions, 11 deletions
diff --git a/net/base/winsock_init.cc b/net/base/winsock_init.cc
index 5c3f005..ccaf01c 100644
--- a/net/base/winsock_init.cc
+++ b/net/base/winsock_init.cc
@@ -13,11 +13,11 @@ namespace {
class WinsockInitSingleton {
public:
- WinsockInitSingleton() : did_init_(false) {
+ WinsockInitSingleton() {
WORD winsock_ver = MAKEWORD(2, 2);
WSAData wsa_data;
- did_init_ = (WSAStartup(winsock_ver, &wsa_data) == 0);
- if (did_init_) {
+ bool did_init = (WSAStartup(winsock_ver, &wsa_data) == 0);
+ if (did_init) {
DCHECK(wsa_data.wVersion == winsock_ver);
// The first time WSAGetLastError is called, the delay load helper will
@@ -32,12 +32,9 @@ class WinsockInitSingleton {
}
~WinsockInitSingleton() {
- if (did_init_)
- WSACleanup();
+ // Don't call WSACleanup() since the worker pool threads can continue to
+ // call getaddrinfo() after Winsock has shutdown, which can lead to crashes.
}
-
- private:
- bool did_init_;
};
} // namespace
diff --git a/net/base/winsock_init.h b/net/base/winsock_init.h
index ab34fb0..9608e95 100644
--- a/net/base/winsock_init.h
+++ b/net/base/winsock_init.h
@@ -3,9 +3,7 @@
// found in the LICENSE file.
// Winsock initialization must happen before any Winsock calls are made. The
-// EnsureWinsockInit method will make sure that WSAStartup has been called. If
-// the call to WSAStartup caused Winsock to initialize, WSACleanup will be
-// called automatically on program shutdown.
+// EnsureWinsockInit method will make sure that WSAStartup has been called.
#ifndef NET_BASE_WINSOCK_INIT_H_
#define NET_BASE_WINSOCK_INIT_H_