From a54f98c20301a71efe5e73a8fc5e1bcd66f2bd34 Mon Sep 17 00:00:00 2001 From: "Yang, Ying-chao" Date: Thu, 13 Jun 2024 17:33:47 +0800 Subject: virtualkeyboard: check if VirtualKeyboard is valid before accessing client. (#6460) This fixes crash when restarting fcitx (#6378) --- src/protocols/InputMethodV2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/protocols/InputMethodV2.cpp') diff --git a/src/protocols/InputMethodV2.cpp b/src/protocols/InputMethodV2.cpp index 5d0bd417..24f7ad54 100644 --- a/src/protocols/InputMethodV2.cpp +++ b/src/protocols/InputMethodV2.cpp @@ -81,7 +81,7 @@ SP CInputMethodKeyboardGrabV2::getOwner() { } wl_client* CInputMethodKeyboardGrabV2::client() { - return resource->client(); + return resource->resource() ? resource->client() : nullptr; } CInputMethodPopupV2::CInputMethodPopupV2(SP resource_, SP owner_, SP surface) : resource(resource_), owner(owner_) { @@ -373,4 +373,4 @@ void CInputMethodV2Protocol::onGetIME(CZwpInputMethodManagerV2* mgr, wl_resource LOGM(LOG, "New IME with resource id {}", id); events.newIME.emit(RESOURCE); -} \ No newline at end of file +} -- cgit v1.2.3