Commit 7a1870d564cfd99e370117a6e13d7fa05f0cdcf0
1 parent
62f0b5fa
Exists in
master
and in
3 other branches
Fixing segfault when user press enter on a locked terminal.
Showing
1 changed file
with
11 additions
and
7 deletions
Show diff stats
src/lib3270/kybd.c
@@ -172,6 +172,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type) | @@ -172,6 +172,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type) | ||
172 | // If typeahead disabled, complain and drop it. | 172 | // If typeahead disabled, complain and drop it. |
173 | if (!hSession->typeahead) | 173 | if (!hSession->typeahead) |
174 | { | 174 | { |
175 | + lib3270_ring_bell(hSession); | ||
175 | lib3270_trace_event(hSession,"typeahead action dropped (no typeahead)\n"); | 176 | lib3270_trace_event(hSession,"typeahead action dropped (no typeahead)\n"); |
176 | return NULL; | 177 | return NULL; |
177 | } | 178 | } |
@@ -206,7 +207,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type) | @@ -206,7 +207,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type) | ||
206 | { | 207 | { |
207 | struct ta *ta = new_ta(hSession, TA_TYPE_KEY_AID); | 208 | struct ta *ta = new_ta(hSession, TA_TYPE_KEY_AID); |
208 | 209 | ||
209 | - if(!ta) | 210 | + if(ta) |
210 | return; | 211 | return; |
211 | 212 | ||
212 | ta->args.aid_code = aid_code; | 213 | ta->args.aid_code = aid_code; |
@@ -241,11 +242,13 @@ void enq_action(H3270 *hSession, int (*fn)(H3270 *)) | @@ -241,11 +242,13 @@ void enq_action(H3270 *hSession, int (*fn)(H3270 *)) | ||
241 | { | 242 | { |
242 | struct ta *ta = new_ta(hSession, TA_TYPE_ACTION); | 243 | struct ta *ta = new_ta(hSession, TA_TYPE_ACTION); |
243 | 244 | ||
244 | - ta->args.action = fn; | 245 | + if(!ta) |
246 | + return; | ||
245 | 247 | ||
248 | + ta->args.action = fn; | ||
246 | lib3270_trace_event(hSession,"single action queued (kybdlock 0x%x)\n", hSession->kybdlock); | 249 | lib3270_trace_event(hSession,"single action queued (kybdlock 0x%x)\n", hSession->kybdlock); |
247 | -} | ||
248 | 250 | ||
251 | +} | ||
249 | 252 | ||
250 | /** | 253 | /** |
251 | * @brief Execute an action from the typeahead queue. | 254 | * @brief Execute an action from the typeahead queue. |
@@ -442,10 +445,11 @@ static void operator_error(H3270 *hSession, int error_type) | @@ -442,10 +445,11 @@ static void operator_error(H3270 *hSession, int error_type) | ||
442 | } | 445 | } |
443 | } | 446 | } |
444 | 447 | ||
445 | - | ||
446 | -/* | ||
447 | - * Handle an AID (Attention IDentifier) key. This is the common stuff that | ||
448 | - * gets executed for all AID keys (PFs, PAs, Clear and etc). | 448 | +/** |
449 | + * @brief Handle an AID (Attention IDentifier) key. | ||
450 | + * | ||
451 | + * This is the common stuff that gets executed for all AID keys (PFs, PAs, Clear and etc). | ||
452 | + * | ||
449 | */ | 453 | */ |
450 | static void key_AID(H3270 *hSession, unsigned char aid_code) | 454 | static void key_AID(H3270 *hSession, unsigned char aid_code) |
451 | { | 455 | { |