From f80d7e329344eb1fe80b8dcc407c62bba0740952 Mon Sep 17 00:00:00 2001 From: Hosang Kim Date: Wed, 27 May 2020 10:05:30 -0400 Subject: [PATCH] ecore_wl2_window: copy available rotation info. Summary: ecore_wl2_window doesn't copy rotation information. If passed pointer is destroyed, rotation information disappears. So add memory allocating for managing information. Reviewers: CHAN, devilhorns Reviewed By: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11891 --- src/lib/ecore_wl2/ecore_wl2_window.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index 711539f..d522977 100644 --- a/src/lib/ecore_wl2/ecore_wl2_window.c +++ b/src/lib/ecore_wl2/ecore_wl2_window.c @@ -1341,6 +1341,9 @@ ecore_wl2_window_free(Ecore_Wl2_Window *window) window->input_region = NULL; // + if (window->wm_rot.available_rots) free(window->wm_rot.available_rots); + window->wm_rot.available_rots = NULL; + display->windows = eina_inlist_remove(display->windows, EINA_INLIST_GET(window)); @@ -2330,13 +2333,28 @@ ecore_wl2_window_preferred_rotation_get(Ecore_Wl2_Window *window) EAPI void ecore_wl2_window_available_rotations_set(Ecore_Wl2_Window *window, const int *rots, unsigned int count) { + unsigned int i = 0; EINA_SAFETY_ON_NULL_RETURN(window); // TIZEN_ONLY _tizen_rotation_available_angles_set(window, rots, count); // + + if (window->wm_rot.available_rots) + { + free(window->wm_rot.available_rots); + window->wm_rot.available_rots = NULL; + } window->wm_rot.count = count; - window->wm_rot.available_rots = (int *)rots; + + if (count >= 1) + { + window->wm_rot.available_rots = calloc(count, sizeof(int)); + if (!window->wm_rot.available_rots) return; + + for (; i < count; i++) + window->wm_rot.available_rots[i] = ((int *)rots)[i]; + } } EAPI Eina_Bool -- 2.7.4