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

View File

@ -356,8 +356,8 @@ public:
AndroidGeckoEvent(int aType) { AndroidGeckoEvent(int aType) {
Init(aType); Init(aType);
} }
AndroidGeckoEvent(void *window, int x1, int y1, int x2, int y2) { AndroidGeckoEvent(int x1, int y1, int x2, int y2) {
Init(window, x1, y1, x2, y2); Init(x1, y1, x2, y2);
} }
AndroidGeckoEvent(JNIEnv *jenv, jobject jobj) { AndroidGeckoEvent(JNIEnv *jenv, jobject jobj) {
Init(jenv, jobj); Init(jenv, jobj);
@ -365,12 +365,11 @@ public:
void Init(JNIEnv *jenv, jobject jobj); void Init(JNIEnv *jenv, jobject jobj);
void Init(int aType); 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 Action() { return mAction; }
int Type() { return mType; } int Type() { return mType; }
int64_t Time() { return mTime; } int64_t Time() { return mTime; }
void *NativeWindow() { return mNativeWindow; }
const nsIntPoint& P0() { return mP0; } const nsIntPoint& P0() { return mP0; }
const nsIntPoint& P1() { return mP1; } const nsIntPoint& P1() { return mP1; }
float X() { return mX; } float X() { return mX; }
@ -394,7 +393,6 @@ protected:
int mAction; int mAction;
int mType; int mType;
int64_t mTime; int64_t mTime;
void *mNativeWindow;
nsIntPoint mP0; nsIntPoint mP0;
nsIntPoint mP1; nsIntPoint mP1;
nsIntRect mRect; 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); EVLOG("nsAppShell: event %p %d [ndraws %d]", (void*)curEvent.get(), curEvent->Type(), mNumDraws);
nsWindow *target = (nsWindow*) curEvent->NativeWindow();
switch (curEvent->Type()) { switch (curEvent->Type()) {
case AndroidGeckoEvent::NATIVE_POKE: case AndroidGeckoEvent::NATIVE_POKE:
NativeEventCallback(); NativeEventCallback();
@ -311,10 +309,7 @@ nsAppShell::ProcessNextNativeEvent(PRBool mayWait)
} }
default: default:
if (target) nsWindow::OnGlobalAndroidEvent(curEvent);
target->OnAndroidEvent(curEvent);
else
nsWindow::OnGlobalAndroidEvent(curEvent);
} }
EVLOG("nsAppShell: -- done event %p %d", (void*)curEvent.get(), curEvent->Type()); 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 we are now in the toplevel window's hierarchy, schedule a redraw
if (FindTopLevel() == TopWindow()) 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; return NS_OK;
} }
@ -362,7 +362,7 @@ nsWindow::Show(PRBool aState)
BringToFront(); BringToFront();
} }
} else if (FindTopLevel() == TopWindow()) { } 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? // Should we skip honoring aRepaint here?
if (aRepaint && FindTopLevel() == TopWindow()) 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; return NS_OK;
} }
@ -513,7 +513,7 @@ nsWindow::Invalidate(const nsIntRect &aRect,
PRBool aIsSynchronous) PRBool aIsSynchronous)
{ {
ALOG("nsWindow::Invalidate %p [%d %d %d %d]", (void*) this, aRect.x, aRect.y, aRect.width, aRect.height); 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; return NS_OK;
} }
@ -579,7 +579,7 @@ nsWindow::BringToFront()
nsGUIEvent event(PR_TRUE, NS_ACTIVATE, this); nsGUIEvent event(PR_TRUE, NS_ACTIVATE, this);
DispatchEvent(&event); DispatchEvent(&event);
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(TopWindow(), -1, -1, -1, -1)); nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(-1, -1, -1, -1));
} }
NS_IMETHODIMP NS_IMETHODIMP