text: Don't crash if a seat has no keyboard
A keyboard might not be present in a seat, so check that before dereferencing keyboard related pointers. Also, use the keyboard pointer we set to shorten the code a little bit. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
This commit is contained in:
committed by
Pekka Paalanen
parent
943b46ed66
commit
f0aaa41748
+10
-6
@@ -755,15 +755,19 @@ input_method_context_create(struct text_input *model,
|
|||||||
static void
|
static void
|
||||||
input_method_context_end_keyboard_grab(struct input_method_context *context)
|
input_method_context_end_keyboard_grab(struct input_method_context *context)
|
||||||
{
|
{
|
||||||
struct weston_keyboard_grab *grab =
|
struct weston_keyboard_grab *grab;
|
||||||
&context->input_method->seat->keyboard->input_method_grab;
|
struct weston_keyboard *keyboard;
|
||||||
struct weston_keyboard *keyboard = grab->keyboard;
|
|
||||||
|
|
||||||
if (!grab->keyboard)
|
if (!context->input_method->seat->keyboard)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (grab->keyboard->grab == grab)
|
grab = &context->input_method->seat->keyboard->input_method_grab;
|
||||||
weston_keyboard_end_grab(grab->keyboard);
|
keyboard = grab->keyboard;
|
||||||
|
if (!keyboard)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (keyboard->grab == grab)
|
||||||
|
weston_keyboard_end_grab(keyboard);
|
||||||
|
|
||||||
keyboard->input_method_resource = NULL;
|
keyboard->input_method_resource = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user