Skip to content

Commit 31480fb

Browse files
committed
Fix tcore IMF context null deref in destructor on create failure
When tizen_core_imf_context_create fails in the constructor, imf_context_ stays nullptr and the constructor returns early without registering any callbacks. The destructor still called UnregisterInputPanelEventCallback and UnregisterEventCallbacks unconditionally; both FT_ASSERT(imf_context_) and then pass the null handle to tizen_core_imf_context_del_*_callback, aborting in debug builds and dereferencing null in release builds. Guard the unregister/destroy calls behind the imf_context_ null check so they only run when registration actually happened, mirroring the constructor's early return.
1 parent b378d8f commit 31480fb

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

flutter/shell/platform/tizen/tizen_input_method_context_tcore.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,9 @@ TizenInputMethodContext::TizenInputMethodContext(uintptr_t window_id) {
151151
}
152152

153153
TizenInputMethodContext::~TizenInputMethodContext() {
154-
UnregisterInputPanelEventCallback();
155-
UnregisterEventCallbacks();
156-
157154
if (imf_context_) {
155+
UnregisterInputPanelEventCallback();
156+
UnregisterEventCallbacks();
158157
tizen_core_imf_context_destroy(imf_context_);
159158
}
160159

0 commit comments

Comments
 (0)