File: | SetSens.c |
Location: | line 117, column 9 |
Description: | Dereference of null pointer |
1 | /*********************************************************** |
2 | Copyright (c) 1993, Oracle and/or its affiliates. All rights reserved. |
3 | |
4 | Permission is hereby granted, free of charge, to any person obtaining a |
5 | copy of this software and associated documentation files (the "Software"), |
6 | to deal in the Software without restriction, including without limitation |
7 | the rights to use, copy, modify, merge, publish, distribute, sublicense, |
8 | and/or sell copies of the Software, and to permit persons to whom the |
9 | Software is furnished to do so, subject to the following conditions: |
10 | |
11 | The above copyright notice and this permission notice (including the next |
12 | paragraph) shall be included in all copies or substantial portions of the |
13 | Software. |
14 | |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
18 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
20 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | DEALINGS IN THE SOFTWARE. |
22 | |
23 | Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. |
24 | |
25 | All Rights Reserved |
26 | |
27 | Permission to use, copy, modify, and distribute this software and its |
28 | documentation for any purpose and without fee is hereby granted, |
29 | provided that the above copyright notice appear in all copies and that |
30 | both that copyright notice and this permission notice appear in |
31 | supporting documentation, and that the name of Digital not be |
32 | used in advertising or publicity pertaining to distribution of the |
33 | software without specific, written prior permission. |
34 | |
35 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING |
36 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL |
37 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR |
38 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, |
39 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, |
40 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
41 | SOFTWARE. |
42 | |
43 | ******************************************************************/ |
44 | |
45 | /* |
46 | |
47 | Copyright 1987, 1988, 1998 The Open Group |
48 | |
49 | Permission to use, copy, modify, distribute, and sell this software and its |
50 | documentation for any purpose is hereby granted without fee, provided that |
51 | the above copyright notice appear in all copies and that both that |
52 | copyright notice and this permission notice appear in supporting |
53 | documentation. |
54 | |
55 | The above copyright notice and this permission notice shall be included in |
56 | all copies or substantial portions of the Software. |
57 | |
58 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
59 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
60 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
61 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
62 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
63 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
64 | |
65 | Except as contained in this notice, the name of The Open Group shall not be |
66 | used in advertising or otherwise to promote the sale, use or other dealings |
67 | in this Software without prior written authorization from The Open Group. |
68 | |
69 | */ |
70 | |
71 | #ifdef HAVE_CONFIG_H1 |
72 | #include <config.h> |
73 | #endif |
74 | #include "IntrinsicI.h" |
75 | #include "StringDefs.h" |
76 | |
77 | /* |
78 | * XtSetSensitive() |
79 | */ |
80 | |
81 | static void SetAncestorSensitive( |
82 | register Widget widget, |
83 | Boolean ancestor_sensitive) |
84 | { |
85 | Arg args[1]; |
86 | register Cardinal i; |
87 | register WidgetList children; |
88 | |
89 | if (widget->core.ancestor_sensitive == ancestor_sensitive) return; |
90 | |
91 | XtSetArg(args[0], XtNancestorSensitive, ancestor_sensitive)((void)( (args[0]).name = (((char*)&XtStrings[34])), (args [0]).value = (XtArgVal)(ancestor_sensitive) )); |
92 | XtSetValues(widget, args, XtNumber(args)((Cardinal) (sizeof(args) / sizeof(args[0])))); |
93 | |
94 | /* If widget's sensitive is TRUE, propagate new ancestor_sensitive to |
95 | children's ancestor_sensitive; else do nothing as children's |
96 | ancestor_sensitive is already FALSE */ |
97 | |
98 | if (widget->core.sensitive && XtIsComposite(widget)(((Object)(widget))->object.widget_class->core_class.class_inited & 0x08)) { |
99 | children = ((CompositeWidget) widget)->composite.children; |
100 | for (i=0; i < ((CompositeWidget)widget)->composite.num_children; i++) { |
101 | SetAncestorSensitive (children[i], ancestor_sensitive); |
102 | } |
103 | } |
104 | } /* SetAncestorSensitive */ |
105 | |
106 | |
107 | void XtSetSensitive( |
108 | register Widget widget, |
109 | _XtBooleanBoolean sensitive) |
110 | { |
111 | Arg args[1]; |
112 | register Cardinal i; |
113 | register WidgetList children; |
114 | WIDGET_TO_APPCON(widget)XtAppContext app = (widget && _XtProcessLock ? XtWidgetToApplicationContext (widget) : ((void*)0)); |
115 | |
116 | LOCK_APP(app)if(app && app->lock)(*app->lock)(app); |
117 | if (widget->core.sensitive == sensitive) { |
Dereference of null pointer | |
118 | UNLOCK_APP(app)if(app && app->unlock)(*app->unlock)(app); |
119 | return; |
120 | } |
121 | |
122 | XtSetArg(args[0], XtNsensitive, sensitive)((void)( (args[0]).name = (((char*)&XtStrings[711])), (args [0]).value = (XtArgVal)(sensitive) )); |
123 | XtSetValues(widget, args, XtNumber(args)((Cardinal) (sizeof(args) / sizeof(args[0])))); |
124 | |
125 | /* If widget's ancestor_sensitive is TRUE, propagate new sensitive to |
126 | children's ancestor_sensitive; else do nothing as children's |
127 | ancestor_sensitive is already FALSE */ |
128 | |
129 | if (widget->core.ancestor_sensitive && XtIsComposite (widget)(((Object)(widget))->object.widget_class->core_class.class_inited & 0x08)) { |
130 | children = ((CompositeWidget) widget)->composite.children; |
131 | for (i = 0; i < ((CompositeWidget)widget)->composite.num_children; i++){ |
132 | SetAncestorSensitive (children[i], sensitive); |
133 | } |
134 | } |
135 | UNLOCK_APP(app)if(app && app->unlock)(*app->unlock)(app); |
136 | } /* XtSetSensitive */ |