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

findTopLevelByShell unexpectedly returns NULL value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.4.1
    • client-libs
    • x86
    • solaris_7

      Name: dmR10075 Date: 12/11/2001

      ###@###.###

      The problem is in the Solaris native code, awt_MToolkit.c:shouldDispatchToWidget
      The problem was introduced by the fix for 4530925.

      Here is the excerpt from mail message(Brent Christian, Wed, 05 Dec 2001 20:21:40):
      ---------------------
      Here's the problem code:

              /* If we are on a non-choice widget, process events in a normal way */
              if ((focusWidget != NULL) && (focusWidget != widget)) {
                  if (isTheSameShellWidget(focusWidget, widget)) {
                      focusWidget = findTopLevelByShell(widget);
                  }
      --> peer = findPeer(&focusWidget);
                  if (peer != NULL) {
                      widget = focusWidget;
                      win = xev->xkey.window = XtWindow(focusWidget);
                  }
              }

      focusWidget is checked for NULL, but sometimes set again by findTopLevelByShell(), and then not checked for
      NULL again. To keep things from crashing so I could complete the integration, I just added a NULL check:

                  if (isTheSameShellWidget(focusWidget, widget)) {
                      focusWidget = findTopLevelByShell(widget);
                  }
      --> if (focusWidget != NULL) {
                      peer = findPeer(&focusWidget);
      --> }
                  if (peer != NULL) {
                      widget = focusWidget;
                      win = xev->xkey.window = XtWindow(focusWidget);
                  }

      This fixed the problem. I wanted to let you know what I did because I don't know if findTopLevelByShell() is
      supposed to return NULL or not, or if similar problems might be hiding elsewhere in the code.
      -------------------

      While the crash has been fixed in the workspace it looks like the problem is more complicated - the code
      doesn't expect that in this particular case findTopLevelByShell will return NULL. The body of
      "if (isTheSameShellWidget(focusWidget, widget)) {" should be modified to always return non-NULL value.

      ======================================================================
      ###@###.### 10/12/04 15:17 GMT

            ant Anton Tarasov (Inactive)
            domsunw Dom Dom (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: