From 6ce7460161e33cd9e12170a6858fb48cc3ac0bc9 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Mon, 28 Apr 2025 21:36:37 +0800 Subject: [PATCH] opt: optimize clean input_method data to avoid crash when exit maomao --- src/maomao.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/maomao.c b/src/maomao.c index 4374bc9..0bb1376 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -2397,8 +2397,6 @@ void cleanup(void) { xwayland = NULL; #endif - input_method_relay_finish(input_method_relay); - wl_display_destroy_clients(dpy); if (child_pid > 0) { kill(-child_pid, SIGTERM); @@ -2408,6 +2406,8 @@ void cleanup(void) { destroykeyboardgroup(&kb_group->destroy, NULL); + input_method_relay_finish(input_method_relay); + /* If it's not destroyed manually it will cause a use-after-free of wlr_seat. * Destroy it until it's fixed in the wlroots side */ wlr_backend_destroy(backend);