Skip to content

Commit

Permalink
check if VirtualKeyboard is valid before accessing.
Browse files Browse the repository at this point in the history
This fixes crash when restarting fcitx (#6378)
  • Loading branch information
yangyingchao committed Jun 12, 2024
1 parent a9d7bef commit e724a44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/protocols/InputMethodV2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_) {
Expand Down Expand Up @@ -373,4 +373,4 @@ void CInputMethodV2Protocol::onGetIME(CZwpInputMethodManagerV2* mgr, wl_resource
LOGM(LOG, "New IME with resource id {}", id);

events.newIME.emit(RESOURCE);
}
}
4 changes: 2 additions & 2 deletions src/protocols/VirtualKeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ wlr_keyboard* CVirtualKeyboardV1Resource::wlr() {
}

wl_client* CVirtualKeyboardV1Resource::client() {
return resource->client();
return resource->resource() ? resource->client() : nullptr;
}

void CVirtualKeyboardV1Resource::releasePressed() {
Expand Down Expand Up @@ -151,4 +151,4 @@ void CVirtualKeyboardProtocol::onCreateKeeb(CZwpVirtualKeyboardManagerV1* pMgr,
LOGM(LOG, "New VKeyboard at id {}", id);

events.newKeyboard.emit(RESOURCE);
}
}

0 comments on commit e724a44

Please sign in to comment.