_XtGetPerWidgetInput() can return NULL, move check so that
pwi->queryEventDescendant and friends are covered

re,
 wh

Signed-off-by: [email protected]


--- libXt-1.0.8/src/Keyboard.c.org      2010-10-20 20:26:05.000000000 +0200
+++ libXt-1.0.8/src/Keyboard.c  2010-10-20 20:40:35.000000000 +0200
@@ -729,18 +729,21 @@
      */
     Widget ancestor = (Widget)client_data;
     XtPerWidgetInput pwi = _XtGetPerWidgetInput(ancestor, FALSE);
-    Widget target = pwi->queryEventDescendant;

-    /* use of 'target' is non-standard hackery; allows focus to non-widget */
-    if (pwi && (pwi->focusKid == target)) {
+    if (pwi) {
+      Widget target = pwi->queryEventDescendant;
+
+      /* use of 'target' is non-standard hackery; allows focus to non-widget */
+      if ( pwi->focusKid == target ) {
        AddFocusHandler(ancestor, target, pwi,
                        _XtGetPerWidgetInput(GetShell(ancestor), TRUE),
                        _XtGetPerDisplayInput(XtDisplay(ancestor)),
                        (EventMask)0);
+      }
+      XtRemoveEventHandler(widget, XtAllEvents, True,
+                          QueryEventMask, client_data);
+      pwi->map_handler_added = FALSE;
     }
-    XtRemoveEventHandler(widget, XtAllEvents, True,
-                        QueryEventMask, client_data);
-    pwi->map_handler_added = FALSE;
 }


_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to