threads and Window.dispose

From: John Harrison (john_andronicus_at_hotmail.com)
Date: 03/29/04


Date: Mon, 29 Mar 2004 11:52:18 +0100

I'm working on a large java app which was written by someone else. I'm also
a java newbie.

My problem is that the application hangs on Mac OS X with the 1.4.2
platform, it did not hang on 1.3.1 and it does not hang on Windows.

It seems to be a thread deadlock situation and the cause is code like the
following

class SomeWindow extends Window
{
    ...
    public void dispose()
    {
        synchronized (this)
        {
            // some app specific code
            ...
            super.dispose();
        }
    }
    ...
}

The problem goes away if I remove the synchronized keyword, it also goes
away if I remove the call to super.dispose() from inside the synchronized
clause.

So my question is whether code like the above is legitimate, or is there
something wrong with disposing of a Window while synchronizing on it.

Thanks,
John



Relevant Pages

  • Re: threads and Window.dispose
    ... > I'm working on a large java app which was written by someone else. ... it did not hang on 1.3.1 and it does not hang on Windows. ... > something wrong with disposing of a Window while synchronizing on it. ...
    (comp.lang.java.gui)
  • Re: threads and Window.dispose
    ... > I'm working on a large java app which was written by someone else. ... it did not hang on 1.3.1 and it does not hang on Windows. ... > something wrong with disposing of a Window while synchronizing on it. ... The general rule of thumb to be followed while synchronizing to any object is ...
    (comp.lang.java.gui)
  • Re: threads and Window.dispose
    ... > I'm working on a large java app which was written by someone else. ... it did not hang on 1.3.1 and it does not hang on Windows. ... > something wrong with disposing of a Window while synchronizing on it. ...
    (comp.lang.java.gui)
  • Network adapter causing freezes...
    ... the computer would appear to hang. ... Intel PRO/100 VE Network Adapter and the computer ... don't open a new window. ...
    (microsoft.public.windowsxp.general)
  • Intermitent Problems with Windows XP w/sp2 and IE6
    ... Stopping of Windows Critical Updates in the middle of the download. ... of a second window on a forum. ... viewer, one application hang for IE with the version number, address, etc. ... IE errors after closing IE stating that the memory could not be read. ...
    (microsoft.public.windowsxp.general)