Fix initialization for backward compatibility 52/136252/2
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 29 Jun 2017 00:54:40 +0000 (09:54 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 29 Jun 2017 01:44:51 +0000 (10:44 +0900)
Change-Id: I6e79e03ad3f0162f6c071de4179d9009cbaaeb61
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/appcore-efl.c

index d7f0db83c66c41340b0c07436234194c18964a91..f154538d129ecff98e60ee8d5af5e97dbf5672c5 100644 (file)
@@ -374,7 +374,8 @@ static void __on_resume(struct ui_priv *ui, bundle *b)
                __appcore_timer_del(ui);
 #endif
 
-       if (ui->state == AS_PAUSED || ui->state == AS_CREATED) {
+       if (ui->state == AS_PAUSED || ui->state == AS_CREATED ||
+                       ui->state == AS_NONE) {
                _DBG("[APP %d] RESUME", _pid);
                if (ui->ops->resume) {
                        traceBegin(TTRACE_TAG_APPLICATION_MANAGER,
@@ -1019,6 +1020,41 @@ static void __add_climsg_cb(struct ui_priv *ui)
 #endif
 }
 
+static void __del_climsg_cb(struct ui_priv *ui)
+{
+       if (ui->hshow) {
+               ecore_event_handler_del(ui->hshow);
+               ui->hshow = NULL;
+       }
+
+       if (ui->hhide) {
+               ecore_event_handler_del(ui->hhide);
+               ui->hhide = NULL;
+       }
+
+       if (ui->hvchange) {
+               ecore_event_handler_del(ui->hvchange);
+               ui->hvchange = NULL;
+       }
+
+#if defined(WAYLAND)
+       if (ui->hlower) {
+               ecore_event_handler_del(ui->hlower);
+               ui->hlower = NULL;
+       }
+
+       if (ui->hpvchange) {
+               ecore_event_handler_del(ui->hpvchange);
+               ui->hpvchange = NULL;
+       }
+#elif defined(X11)
+       if (ui->hcmsg) {
+               ecore_event_handler_del(ui->hcmsg);
+               ui->hcmsg = NULL;
+       }
+#endif
+}
+
 static int __before_loop(struct ui_priv *ui, int *argc, char ***argv)
 {
        int r;
@@ -1072,6 +1108,7 @@ static int __before_loop(struct ui_priv *ui, int *argc, char ***argv)
        }
 
        LOG(LOG_DEBUG, "LAUNCH", "[%s:Platform:appcore_init:done]", ui->name);
+       __add_climsg_cb(ui);
        if (ui->ops && ui->ops->create) {
                traceBegin(TTRACE_TAG_APPLICATION_MANAGER, "APPCORE:CREATE");
                r = ui->ops->create(ui->ops->data);
@@ -1085,6 +1122,7 @@ static int __before_loop(struct ui_priv *ui, int *argc, char ***argv)
                                ui->ops->terminate(ui->ops->data);
                                traceEnd(TTRACE_TAG_APPLICATION_MANAGER);
                        }
+                       __del_climsg_cb(ui);
                        errno = ECANCELED;
                        return -1;
                }
@@ -1093,8 +1131,6 @@ static int __before_loop(struct ui_priv *ui, int *argc, char ***argv)
        }
        ui->state = AS_CREATED;
 
-       __add_climsg_cb(ui);
-
        return 0;
 }
 
@@ -1121,19 +1157,7 @@ static void __after_loop(struct ui_priv *ui)
 
        ui->state = AS_DYING;
 
-       if (ui->hshow)
-               ecore_event_handler_del(ui->hshow);
-       if (ui->hhide)
-               ecore_event_handler_del(ui->hhide);
-       if (ui->hvchange)
-               ecore_event_handler_del(ui->hvchange);
-#if defined(WAYLAND)
-       if (ui->hlower)
-               ecore_event_handler_del(ui->hlower);
-       if (ui->hpvchange)
-               ecore_event_handler_del(ui->hpvchange);
-#endif
-
+       __del_climsg_cb(ui);
        __appcore_timer_del(ui);
        __finish_wl();
        elm_shutdown();