ctx->surrounding_cursor = strlen(ctx->preedit_str);
}
- free(ctx->preedit_str);
+ if (ctx->preedit_str)
+ free (ctx->preedit_str);
+
ctx->preedit_str = strdup("");
}
if (!ctx)
return false;
- *text = strdup (ctx->surrounding_text);
- *cursor_pos = ctx->surrounding_cursor;
+ if (text)
+ *text = strdup (ctx->surrounding_text);
+
+ if (cursor_pos)
+ *cursor_pos = ctx->surrounding_cursor;
return true;
}
{
struct weescim *wsc = (weescim*)data;
- free (wsc->surrounding_text);
+ if (wsc->surrounding_text)
+ free (wsc->surrounding_text);
+
wsc->surrounding_text = strdup (text);
wsc->surrounding_cursor = cursor;
}
wsc->content_hint = WL_TEXT_INPUT_CONTENT_HINT_NONE;
wsc->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NORMAL;
- free (wsc->language);
- wsc->language = NULL;
+ if (wsc->language) {
+ free (wsc->language);
+ wsc->language = NULL;
+ }
- free (wsc->surrounding_text);
- wsc->surrounding_text = NULL;
+ if (wsc->surrounding_text) {
+ free (wsc->surrounding_text);
+ wsc->surrounding_text = NULL;
+ }
wsc->im_ctx = im_ctx;
wl_input_method_context_add_listener (im_ctx, &wsc_im_context_listener, wsc);
isf_wsc_context_del(wsc->wsc_ctx);
isf_wsc_context_shutdown ();
- free (wsc->preedit_str);
- free (wsc->surrounding_text);
+ if (wsc->preedit_str) {
+ free (wsc->preedit_str);
+ wsc->preedit_str = NULL;
+ }
+
+ if (wsc->surrounding_text) {
+ free (wsc->surrounding_text);
+ wsc->surrounding_text = NULL;
+ }
}
int main (int argc EINA_UNUSED, char **argv EINA_UNUSED)