keyrouter: Fix illegally finishing tizen_security 14/278214/1
authorSeunghun Lee <shiin.lee@samsung.com>
Wed, 8 Jun 2022 07:43:12 +0000 (16:43 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 18 Jul 2022 05:58:54 +0000 (14:58 +0900)
Do not finish tizen_security if the initialization's been failed.

Change-Id: Iee1a6eb973a8513c97aaf27a5b40e2d60c8f1f32

src/keyrouter/keyrouter.c
src/keyrouter/keyrouter.h

index cba286e..991c1f3 100644 (file)
@@ -32,7 +32,8 @@ keyrouter_handle_display_destroy(struct wl_listener *listener, void *data)
 
     wl_signal_emit(&keyrouter->events.destroy, keyrouter);
 
-    tizen_security_finish();
+    if (keyrouter->security_initialized)
+        tizen_security_finish();
 
     free(keyrouter->opts);
 
@@ -79,8 +80,10 @@ ds_tizen_keyrouter_create(struct wl_display *display)
 
     keyrouter_options_set(keyrouter);
 
-    if (!tizen_security_init()) {
-        ds_inf("tizen_security_init() is not sucessful. keyrouter works without security.");
+    keyrouter->security_initialized = tizen_security_init();
+    if (!keyrouter->security_initialized) {
+        ds_inf("tizen_security_init() is not sucessful. "
+                "keyrouter works without security.");
     }
 
     ds_inf("Global created: ds_tizen_keyrouter(%p)", keyrouter);
index ffbb3cd..3d88346 100644 (file)
@@ -56,6 +56,8 @@ struct ds_tizen_keyrouter
     struct ds_tizen_keyrouter_key_options *opts;
 
     struct ds_tizen_keyrouter_grab *keyrouter_grab;
+
+    bool security_initialized;
 };
 
 struct ds_tizen_keyrouter_client