[kaffe] bug about kaffe on nanox

yinzhong shang yzshang at gmail.com
Wed Apr 27 20:30:06 PDT 2005


test code: openFrame.java:

import java.io.*;
import java.awt.*;
import java.awt.event.*;
public class openFrame {
  public static void main(String arv[])
  {
        Frame m_ParentFrame=new Frame();
        m_ParentFrame.resize(640,480);
        Dialog flashwindow=new Dialog (m_ParentFrame, false);
        flashwindow.setBounds(0, 0, 100, 100);
        flashwindow.show();

        try{
        Thread.sleep(1000);
        }catch(Exception e)
        {
        }
        flashwindow.dispose();
        m_ParentFrame.show();
        }
}
After the flashwindow destroyed, this window receive a update event,
so the PaintEvt.java Line63 
 Component source = sources[srcIdx];
get a invalid index.

I modify the nano-x native awt lib code,
handler.c's function hanlderUpdate to
handlerUpdate(JNIEnv *envP, GR_EVENT *eventP)
{
        int index;
        cvm_mw_assert(eventP->update.type == GR_EVENT_TYPE_UPDATE);

        if ( eventP->update.utype == 6 ) {
                return NULL;
        }

        index = getSourceIndex(eventP->exposure.wid);
        if(index < 0 || nanoX.windowsP[index].flags & TLK_SOURCE_DESTROYED)
                return NULL;    //add a check here
        /* create object by VM */
        return (*envP)->CallStaticObjectMethod( envP, PaintEvent, getPaintEvent,
                getCachedSourceIndex(eventP->update.wid),
                TLK_AWT_EVENT_UPDATE,
                eventP->update.x,
                eventP->update.y,
                eventP->update.width,
                eventP->update.height);
}
I think may be other function should do this check too.
and may be someone alse have a better solution. pls tell me.




More information about the kaffe mailing list