summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authordmichael <dmichael@chromium.org>2015-03-25 16:28:21 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-25 23:29:04 +0000
commit18a876a21927546da4868a3afaf78aa6fdd77caa (patch)
tree189a648216d46d4f230adf691fd69423d9ac8d0d /ppapi
parent7fce85a88b57b7b08762690ed9c763ba319f9af8 (diff)
downloadchromium_src-18a876a21927546da4868a3afaf78aa6fdd77caa.zip
chromium_src-18a876a21927546da4868a3afaf78aa6fdd77caa.tar.gz
chromium_src-18a876a21927546da4868a3afaf78aa6fdd77caa.tar.bz2
Pepper: CallOnMainThread should do nothing if Globals are gone
BUG=339912 Review URL: https://codereview.chromium.org/1036913002 Cr-Commit-Position: refs/heads/master@{#322259}
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/proxy/ppb_core_proxy.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/ppapi/proxy/ppb_core_proxy.cc b/ppapi/proxy/ppb_core_proxy.cc
index 4c0b372..0cf2a95 100644
--- a/ppapi/proxy/ppb_core_proxy.cc
+++ b/ppapi/proxy/ppb_core_proxy.cc
@@ -63,6 +63,13 @@ void CallOnMainThread(int delay_in_ms,
if (!callback.func)
return;
ProxyAutoLock lock;
+
+ // If the plugin attempts to call CallOnMainThread from a background thread
+ // at shutdown, it's possible that the PpapiGlobals object or the main loop
+ // has been destroyed.
+ if (!PpapiGlobals::Get() || !PpapiGlobals::Get()->GetMainThreadMessageLoop())
+ return;
+
PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostDelayedTask(
FROM_HERE,
RunWhileLocked(base::Bind(&CallbackWrapper, callback, result)),