Commit 18a876a2 authored by dmichael's avatar dmichael Committed by Commit bot

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}
parent 7fce85a8
...@@ -63,6 +63,13 @@ void CallOnMainThread(int delay_in_ms, ...@@ -63,6 +63,13 @@ void CallOnMainThread(int delay_in_ms,
if (!callback.func) if (!callback.func)
return; return;
ProxyAutoLock lock; 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( PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostDelayedTask(
FROM_HERE, FROM_HERE,
RunWhileLocked(base::Bind(&CallbackWrapper, callback, result)), RunWhileLocked(base::Bind(&CallbackWrapper, callback, result)),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment