Bug 607287 - Crash when trying to disable or uninstall an add-on [@ nsWindow::UserActivity]. r=mwu

--HG--
extra : rebase_source : 0b0c8654fbf4c52471947c929fae23df5f13a585
This commit is contained in:
Doug Turner 2010-10-27 13:10:15 -07:00
parent 04ff8b2cce
commit 228873dd95

View File

@ -663,6 +663,10 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
if (!AndroidBridge::Bridge())
return;
nsWindow *win = TopWindow();
if (!win)
return;
switch (ae->Type()) {
case AndroidGeckoEvent::SIZE_CHANGED: {
int nw = ae->P0().x;
@ -686,12 +690,12 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
}
case AndroidGeckoEvent::MOTION_EVENT: {
TopWindow()->UserActivity();
win->UserActivity();
if (!gTopLevelWindows.IsEmpty()) {
nsIntPoint pt(ae->P0());
pt.x = NS_MIN(NS_MAX(pt.x, 0), gAndroidBounds.width - 1);
pt.y = NS_MIN(NS_MAX(pt.y, 0), gAndroidBounds.height - 1);
nsWindow *target = TopWindow()->FindWindowForPoint(pt);
nsWindow *target = win->FindWindowForPoint(pt);
#if 0
ALOG("MOTION_EVENT %f,%f -> %p (visible: %d children: %d)", ae->P0().x, ae->P0().y, (void*)target,
@ -712,23 +716,22 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
}
case AndroidGeckoEvent::KEY_EVENT:
TopWindow()->UserActivity();
win->UserActivity();
if (gFocusedWindow)
gFocusedWindow->OnKeyEvent(ae);
break;
case AndroidGeckoEvent::DRAW:
if (TopWindow())
TopWindow()->OnDraw(ae);
win->OnDraw(ae);
break;
case AndroidGeckoEvent::IME_EVENT:
TopWindow()->UserActivity();
win->UserActivity();
if (gFocusedWindow) {
gFocusedWindow->OnIMEEvent(ae);
} else {
NS_WARNING("Sending unexpected IME event to top window");
TopWindow()->OnIMEEvent(ae);
win->OnIMEEvent(ae);
}
break;