From: nibha.sharma Date: Thu, 17 Aug 2017 07:08:29 +0000 (+0530) Subject: [CTC][opengl][NonACR][TNEXT-2271,Fixed testhub crash issue] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2be35bb54676c739411636a853306b8f171cb280;p=test%2Ftct%2Fnative%2Fapi.git [CTC][opengl][NonACR][TNEXT-2271,Fixed testhub crash issue] Change-Id: I411bc8a8f1cf9d67c83c3f8f8c356e86474d4804 Signed-off-by: nibha.sharma --- diff --git a/src/ctc/opengl/CTs-opengl-common.h b/src/ctc/opengl/CTs-opengl-common.h index 7a5dad9..19a20df 100755 --- a/src/ctc/opengl/CTs-opengl-common.h +++ b/src/ctc/opengl/CTs-opengl-common.h @@ -86,6 +86,7 @@ Evas_Object *g_pOpenGl2EOWin; gl2_matrix_st *g_pstOpenGl2ProjectionMat; gl2_matrix_st *g_pstOpenGl2ModelViewMat; gl2_matrix_st *g_pstOpenGl2MVPMat; +gl2_renderer_st *g_pstGld; int g_nOpenGl2Delay; int g_nOpenGl2FrameCount; diff --git a/src/ctc/opengl/CTs-opengl.c b/src/ctc/opengl/CTs-opengl.c index ee8ff44..f4346d9 100755 --- a/src/ctc/opengl/CTs-opengl.c +++ b/src/ctc/opengl/CTs-opengl.c @@ -57,6 +57,7 @@ void CTs_opengl_cleanup(void) { elm_shutdown(); } + FREE_MEMORY(g_pstGld); return; } @@ -465,28 +466,24 @@ int CTc_Opengl2_GlDrawCube_p(void) g_pOpenGl2EOWin = NULL; g_nOpenGl2FrameCount = 0; - gl2_renderer_st *pstGld = NULL; - - if ( !(pstGld = calloc(1, sizeof(gl2_renderer_st))) ) - { - FPRINTF("[Line : %d][%s] Insufficient memory for allocation. (calloc failed)\\n", __LINE__, API_NAMESPACE); - return 1; - } nRet = elm_init(0, NULL); if ( nRet < 0 ) { FPRINTF("[Line : %d][%s] elm_init failed and returned invalid new counter's value: %d\\n", __LINE__, API_NAMESPACE, nRet); - FREE_MEMORY(pstGld); return 1; } g_elm_init = true; - + g_pstGld = NULL; + if ( !(g_pstGld = calloc(1, sizeof(gl2_renderer_st))) ) + { + FPRINTF("[Line : %d][%s] Insufficient memory for allocation. (calloc failed)\\n", __LINE__, API_NAMESPACE); + return 1; + } elm_config_accel_preference_set(GL_RENDERING_ENGINE); bIsSuccess = elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); if ( bIsSuccess == EINA_FALSE ) { FPRINTF("[Line : %d][%s] elm_policy_set failed to set elementary policy.\\n", __LINE__, API_NAMESPACE); - FREE_MEMORY(pstGld); return 1; } @@ -494,7 +491,6 @@ int CTc_Opengl2_GlDrawCube_p(void) if ( g_pOpenGl2EOWin == NULL ) { FPRINTF("[Line : %d][%s] elm_win_util_standard_add failed to add a window object with standard setup\\n", __LINE__, API_NAMESPACE); - FREE_MEMORY(pstGld); OpenGl2ElmShutdown(); return 1; } @@ -506,7 +502,6 @@ int CTc_Opengl2_GlDrawCube_p(void) if ( pEOBX == NULL ) { FPRINTF("[Line : %d][%s] elm_box_add failed to add box\\n", __LINE__, API_NAMESPACE); - FREE_MEMORY(pstGld); OpenGl2ElmShutdown(); return 1; } @@ -518,15 +513,13 @@ int CTc_Opengl2_GlDrawCube_p(void) if ( pEOGL == NULL ) { FPRINTF("[Line : %d][%s] elm_glview_add failed to add glview\\n", __LINE__, API_NAMESPACE); - FREE_MEMORY(pstGld); OpenGl2ElmShutdown(); return 1; } - pstGld->pGLApi = elm_glview_gl_api_get(pEOGL); - if ( pstGld->pGLApi == NULL ) + g_pstGld->pGLApi = elm_glview_gl_api_get(pEOGL); + if ( g_pstGld->pGLApi == NULL ) { FPRINTF("[Line : %d][%s] elm_glview_gl_api_get failed to get gl api\\n", __LINE__, API_NAMESPACE); - FREE_MEMORY(pstGld); OpenGl2ElmShutdown(); return 1; } @@ -555,12 +548,11 @@ int CTc_Opengl2_GlDrawCube_p(void) if ( pEcoreAnim == NULL ) { FPRINTF("[Line : %d][%s] ecore_animator_add failed to add animator\\n", __LINE__, API_NAMESPACE); - FREE_MEMORY(pstGld); OpenGl2ElmShutdown(); return 1; } evas_object_data_set(pEOGL, EVAS_OBJECT_DATA_KEY_02, pEcoreAnim); - evas_object_data_set(pEOGL, EVAS_OBJECT_DATA_KEY_01, pstGld); + evas_object_data_set(pEOGL, EVAS_OBJECT_DATA_KEY_01, g_pstGld); evas_object_event_callback_add(pEOGL, EVAS_CALLBACK_DEL, Opengl2_animator_del_cb, pEOGL); g_nOpenGl2Delay = 0; @@ -572,7 +564,6 @@ int CTc_Opengl2_GlDrawCube_p(void) g_eOpenGl2State == DEL_GL_FAILED || g_eOpenGl2State == ANIMATOR_DEL_FAILED ) { - FREE_MEMORY(pstGld); OpenGl2ElmShutdown(); return 1; } @@ -584,7 +575,6 @@ int CTc_Opengl2_GlDrawCube_p(void) evas_object_resize(g_pOpenGl2EOWin, OPENGL2_WIN_WIDTH, OPENGL2_WIN_HEIGHT); evas_object_show(g_pOpenGl2EOWin); elm_run(); - FREE_MEMORY(pstGld); return 0; }