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)), |