Bug 1233812 - Fix possible race in accessing nsAppShell instance; r=snorp

When getting nsAppShell from another thread, there could be a race with
nsAppShell being destroyed on the main thread. This patch makes the raw
nsAppShell pointer only accessible from the main thread, and use a
static mutex to coordinate accessing nsAppShell from other threads.
This commit is contained in:
Jim Chen
2015-12-23 22:03:35 -05:00
parent 73881b6aa8
commit e56235cd4f
7 changed files with 84 additions and 51 deletions

View File

@@ -77,7 +77,7 @@ AndroidContentController::HandleSingleTap(const CSSPoint& aPoint,
CSSIntPoint rounded = RoundedToInt(point);
nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", rounded.x, rounded.y);
nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent(
nsAppShell::PostEvent(AndroidGeckoEvent::MakeBroadcastEvent(
NS_LITERAL_CSTRING("Gesture:SingleTap"), data));
}