bug 614547 - Fennec crash [@ GeckoStart ], don't store pointer to native window r=mwu a=blocking-fennec

This commit is contained in:
Brad Lassey 2011-01-18 19:25:20 -05:00
parent c9574d1be0
commit fe4d61dffb
4 changed files with 11 additions and 22 deletions

View File

@ -130,7 +130,6 @@ AndroidGeckoEvent::InitGeckoEventClass(JNIEnv *jEnv)
jYField = getField("mY", "F");
jZField = getField("mZ", "F");
jRectField = getField("mRect", "Landroid/graphics/Rect;");
jNativeWindowField = getField("mNativeWindow", "I");
jCharactersField = getField("mCharacters", "Ljava/lang/String;");
jKeyCodeField = getField("mKeyCode", "I");
@ -277,7 +276,6 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
mAction = jenv->GetIntField(jobj, jActionField);
mType = jenv->GetIntField(jobj, jTypeField);
mNativeWindow = (void*) jenv->GetIntField(jobj, jNativeWindowField);
switch (mType) {
case SIZE_CHANGED:
@ -347,7 +345,7 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
}
#ifndef ANDROID_DEBUG_EVENTS
ALOG("AndroidGeckoEvent: %p : %d %p", (void*)jobj, mType, (void*)mNativeWindow);
ALOG("AndroidGeckoEvent: %p : %d", (void*)jobj, mType);
#endif
}
@ -355,14 +353,12 @@ void
AndroidGeckoEvent::Init(int aType)
{
mType = aType;
mNativeWindow = nsnull;
}
void
AndroidGeckoEvent::Init(void *window, int x1, int y1, int x2, int y2)
AndroidGeckoEvent::Init(int x1, int y1, int x2, int y2)
{
mType = DRAW;
mNativeWindow = window;
mRect.Empty();
}

View File

@ -356,8 +356,8 @@ public:
AndroidGeckoEvent(int aType) {
Init(aType);
}
AndroidGeckoEvent(void *window, int x1, int y1, int x2, int y2) {
Init(window, x1, y1, x2, y2);
AndroidGeckoEvent(int x1, int y1, int x2, int y2) {
Init(x1, y1, x2, y2);
}
AndroidGeckoEvent(JNIEnv *jenv, jobject jobj) {
Init(jenv, jobj);
@ -365,12 +365,11 @@ public:
void Init(JNIEnv *jenv, jobject jobj);
void Init(int aType);
void Init(void *window, int x1, int y1, int x2, int y2);
void Init(int x1, int y1, int x2, int y2);
int Action() { return mAction; }
int Type() { return mType; }
int64_t Time() { return mTime; }
void *NativeWindow() { return mNativeWindow; }
const nsIntPoint& P0() { return mP0; }
const nsIntPoint& P1() { return mP1; }
float X() { return mX; }
@ -394,7 +393,6 @@ protected:
int mAction;
int mType;
int64_t mTime;
void *mNativeWindow;
nsIntPoint mP0;
nsIntPoint mP1;
nsIntRect mRect;

View File

@ -232,8 +232,6 @@ nsAppShell::ProcessNextNativeEvent(PRBool mayWait)
EVLOG("nsAppShell: event %p %d [ndraws %d]", (void*)curEvent.get(), curEvent->Type(), mNumDraws);
nsWindow *target = (nsWindow*) curEvent->NativeWindow();
switch (curEvent->Type()) {
case AndroidGeckoEvent::NATIVE_POKE:
NativeEventCallback();
@ -311,10 +309,7 @@ nsAppShell::ProcessNextNativeEvent(PRBool mayWait)
}
default:
if (target)
target->OnAndroidEvent(curEvent);
else
nsWindow::OnGlobalAndroidEvent(curEvent);
nsWindow::OnGlobalAndroidEvent(curEvent);
}
EVLOG("nsAppShell: -- done event %p %d", (void*)curEvent.get(), curEvent->Type());

View File

@ -305,7 +305,7 @@ nsWindow::SetParent(nsIWidget *aNewParent)
// if we are now in the toplevel window's hierarchy, schedule a redraw
if (FindTopLevel() == TopWindow())
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(TopWindow(), -1, -1, -1, -1));
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(-1, -1, -1, -1));
return NS_OK;
}
@ -362,7 +362,7 @@ nsWindow::Show(PRBool aState)
BringToFront();
}
} else if (FindTopLevel() == TopWindow()) {
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(TopWindow(), -1, -1, -1, -1));
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(-1, -1, -1, -1));
}
}
@ -459,7 +459,7 @@ nsWindow::Resize(PRInt32 aX,
// Should we skip honoring aRepaint here?
if (aRepaint && FindTopLevel() == TopWindow())
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(TopWindow(), -1, -1, -1, -1));
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(-1, -1, -1, -1));
return NS_OK;
}
@ -513,7 +513,7 @@ nsWindow::Invalidate(const nsIntRect &aRect,
PRBool aIsSynchronous)
{
ALOG("nsWindow::Invalidate %p [%d %d %d %d]", (void*) this, aRect.x, aRect.y, aRect.width, aRect.height);
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(TopWindow(), -1, -1, -1, -1));
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(-1, -1, -1, -1));
return NS_OK;
}
@ -579,7 +579,7 @@ nsWindow::BringToFront()
nsGUIEvent event(PR_TRUE, NS_ACTIVATE, this);
DispatchEvent(&event);
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(TopWindow(), -1, -1, -1, -1));
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(-1, -1, -1, -1));
}
NS_IMETHODIMP