virtualkeyboard: check if VirtualKeyboard is valid before accessing client. (#6460)

This fixes crash when restarting fcitx (#6378)
This commit is contained in:
Yang, Ying-chao
2024-06-13 17:33:47 +08:00
committed by GitHub
parent d677ac6f87
commit a54f98c203
2 changed files with 4 additions and 4 deletions

View File

@@ -81,7 +81,7 @@ SP<CInputMethodV2> CInputMethodKeyboardGrabV2::getOwner() {
}
wl_client* CInputMethodKeyboardGrabV2::client() {
return resource->client();
return resource->resource() ? resource->client() : nullptr;
}
CInputMethodPopupV2::CInputMethodPopupV2(SP<CZwpInputPopupSurfaceV2> resource_, SP<CInputMethodV2> owner_, SP<CWLSurfaceResource> 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);
}
}