Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4141953

memoru leak in awt event handling code

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      solaris_2.5.1

      Description

      This is a bug in the Motif AWT implementation.

      Some AWT event objects are being thrown away without any processing from
      MComponentPeer.handleEvent(). This routine dispatches the event and then
      frees the underlying X event object.

      However, in java.awt.EventQueue.postEvent(), it is possible that the Java
      event object can be overwritten with another Java event object without
      ever calling MComponentPeer.handleEvent(). The Java object is garbage
      collected but the X event object is never freed.

      The code that is causing the problem is in java.awt.EventQueue.postEvent()

                          switch (q.id) {
                            case Event.MOUSE_MOVE:
                            case Event.MOUSE_DRAG:
                                // New-style event id's never collide with
                                // old-style id's, so if the id's are equal,
                                // we can safely cast the queued event to be
                                // an old-style one.
                                MouseEvent e = (MouseEvent)q.event;
                                if (e.getSource() ==
      ((MouseEvent)theEvent).getSource() &&
                                    e.getModifiers() ==
      ((MouseEvent)theEvent).getModifiers()) {
                                    q.event = eqi.event;// just replace old event
                                    return;
                                }
                                break;


      The "just replace old event" is the code that looses the events ...
      MComponentPeer.handleEvent() is never called on the original event - so
      the underlying X event object is not freed.

      Just click on a button and drag as you go, you'll probably create a
      half dozen or more "replaced" events and loose yourself a big chunk of memory
      in the process.


      AWTEvent.consume() may also have the same problem.

        Attachments

          Activity

            People

            • Assignee:
              prssunw Prs Prs (Inactive)
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: