From 600079cc00ad8f53f21540c97e1ed9a863cca90e Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Wed, 6 Jul 2022 16:31:04 +0900 Subject: [PATCH] input: Fix segfault caused by the access null Change-Id: I5b45ab184dbd216de35ad032c03b469aab2116d8 --- src/input/input.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/input/input.c b/src/input/input.c index 8469d13..dbe1bb3 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -171,14 +171,17 @@ handle_top_change(struct wl_listener *listener, void *data) input = wl_container_of(listener, input, top_change); - input->top_view = view; - - if (input->top_view_destroy.notify) + if (input->top_view_destroy.notify) { wl_list_remove(&input->top_view_destroy.link); - else + input->top_view_destroy.notify = NULL; + } + + if (view) { input->top_view_destroy.notify = handle_top_view_destroy; + wl_signal_add(&view->events.destroy, &input->top_view_destroy); + } - wl_signal_add(&view->events.destroy, &input->top_view_destroy); + input->top_view = view; } static void -- 2.7.4