Make MessageLoop::QuitClosure call Quit of the current MessageLoop at call time, not the current MessageLoop at the Closure's creation time. This brings the behaviour of QuitClosure in line with QuitTask.
BUG=
TEST=
Review URL: http://codereview.chromium.org/8354032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106684 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 51718596075d217dc0c8ffdb6bd624fe068fd0c9
diff --git a/base/message_loop.cc b/base/message_loop.cc
index f2e07b9..45bad48 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -365,10 +365,13 @@
}
}
+static void QuitCurrent() {
+ MessageLoop::current()->Quit();
+}
+
// static
base::Closure MessageLoop::QuitClosure() {
- return base::Bind(&MessageLoop::Quit,
- base::Unretained(MessageLoop::current()));
+ return base::Bind(&QuitCurrent);
}
void MessageLoop::SetNestableTasksAllowed(bool allowed) {