From dadd852cd3d15f2627424ccb3cf49c3f6c2edfc8 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 3 Aug 2011 16:24:38 +0000 Subject: [PATCH] In CefContext::RemoveBrowser() allow the call to webkit_glue::ClearCache() to be executed immediately if we're already on the UI thread (which is the case when called "from" CefShutdown()), instead of being posted as a delayed task to avoid a thread death race condition (issue #277). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@273 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- libcef/cef_context.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libcef/cef_context.cc b/libcef/cef_context.cc index 52149c47a..8d3fad8b1 100644 --- a/libcef/cef_context.cc +++ b/libcef/cef_context.cc @@ -565,8 +565,12 @@ bool CefContext::RemoveBrowser(CefRefPtr browser) } if (empty) { - CefThread::PostTask(CefThread::UI, FROM_HERE, - NewRunnableFunction(webkit_glue::ClearCache)); + if (CefThread::CurrentlyOn(CefThread::UI)) { + webkit_glue::ClearCache(); + } else { + CefThread::PostTask(CefThread::UI, FROM_HERE, + NewRunnableFunction(webkit_glue::ClearCache)); + } } return deleted;