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

Unified Diff: ppapi/proxy/ppb_core_proxy.cc

Issue 1036913002: Pepper: CallOnMainThread should do nothing if Globals are gone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improve comment Created 5 years, 9 months 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: ppapi/proxy/ppb_core_proxy.cc
diff --git a/ppapi/proxy/ppb_core_proxy.cc b/ppapi/proxy/ppb_core_proxy.cc
index 4c0b372fe94b3b1415469444bc7c84ff248a9558..0cf2a95ed29ed382871e171b00c5ed83edc646f8 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)),
« 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