summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwalter harms <wharms@bfs.de>2010-10-26 13:46:32 +0200
committerAlan Coopersmith <alan.coopersmith@oracle.com>2010-11-10 22:10:57 -0800
commit59598f20ba160fd92abcf88a30f0008425e7b1ec (patch)
tree5bd99cda296e4abd7b5f24e7b96a4479e5741d96
parent8572cba2b9094dcd8ee5b4c5bcf3c38f1f291918 (diff)
QueryEventMask: fix NULL check
_XtGetPerWidgetInput may return NULL avoid possible NULL references Signed-off-by: walter harms <wharms@bfs.de> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/Keyboard.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/Keyboard.c b/src/Keyboard.c
index 9c8065b..c8ba863 100644
--- a/src/Keyboard.c
+++ b/src/Keyboard.c
@@ -727,18 +727,22 @@ static void QueryEventMask(
*/
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)) {
- AddFocusHandler(ancestor, target, pwi,
- _XtGetPerWidgetInput(GetShell(ancestor), TRUE),
- _XtGetPerDisplayInput(XtDisplay(ancestor)),
- (EventMask)0);
+
+ 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;
}