Fix stop event handling 80/216880/2
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 4 Nov 2019 10:20:12 +0000 (19:20 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 11 Nov 2019 03:29:36 +0000 (12:29 +0900)
When 'Stop' event is occurred, the frame context has to be destroyed.

Change-Id: I1b83c9b47d045f3d7696f5962cadfd643395da93
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
frame-broker/src/frame_broker.c

index c36956f..82b640c 100644 (file)
@@ -159,9 +159,6 @@ static void __scls_evas_stop_cb(uint32_t serial, void *user_data)
 {
        frame_broker_h broker = user_data;
        frame_context_h context = broker->context;
-       frame_direction_e direction;
-       frame_h frame;
-       int ret;
 
        _D("[__SCLS_EVAS__] Stop");
        if (context == NULL) {
@@ -169,21 +166,8 @@ static void __scls_evas_stop_cb(uint32_t serial, void *user_data)
                return;
        }
 
-       frame_context_on_pause(context);
-
-       ret = frame_context_get_frame(context, &frame);
-       if (ret != FRAME_BROKER_ERROR_NONE) {
-               _W("Failed to get frame");
-               return;
-       }
-
-       ret = frame_get_direction(frame, &direction);
-       if ((ret == FRAME_BROKER_ERROR_NONE &&
-                       direction == FRAME_DIRECTION_BACKWARD) ||
-                       frame == NULL) {
-               _D("Destroy context");
-               frame_context_destroy(context);
-       }
+       _D("Destroy context");
+       frame_context_destroy(context);
 }
 
 static frame_context_error_e __convert_error(
@@ -218,8 +202,33 @@ static void __scls_evas_error_cb(
 
 static void __scls_evas_cleanup_cb(uint32_t serial, void *user_data)
 {
-       _D("[__SCLS_EVAS__] Clean Up");
-       __scls_evas_stop_cb(serial, user_data);
+       frame_broker_h broker = user_data;
+       frame_context_h context = broker->context;
+       frame_direction_e direction;
+       frame_h frame;
+       int ret;
+
+       _D("[__SCLS_EVAS__] Clean up");
+       if (context == NULL) {
+               _E("Invalid context");
+               return;
+       }
+
+       frame_context_on_pause(context);
+
+       ret = frame_context_get_frame(context, &frame);
+       if (ret != FRAME_BROKER_ERROR_NONE) {
+               _W("Failed to get frame");
+               return;
+       }
+
+       ret = frame_get_direction(frame, &direction);
+       if ((ret == FRAME_BROKER_ERROR_NONE &&
+                               direction == FRAME_DIRECTION_BACKWARD) ||
+                       frame == NULL) {
+               _D("Destroy context");
+               frame_context_destroy(context);
+       }
 }
 
 API int frame_broker_create(Evas_Object *win,