diff options
author | Hosang Kim <hosang12.kim@samsung.com> | 2020-05-27 10:05:30 -0400 |
---|---|---|
committer | Christopher Michael <devilhorns@comcast.net> | 2020-05-27 10:05:30 -0400 |
commit | d6ce6a8cd541d21cb6fe5bed910238c0cc1fdd00 (patch) | |
tree | bd78825b20e6f234af6a93b036495121edb559d4 | |
parent | 28d41f4e6cb7e07d3a2d7685151beb65edfd77c0 (diff) | |
download | efl-d6ce6a8cd541d21cb6fe5bed910238c0cc1fdd00.tar.gz |
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
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2_window.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index 7d9de5775c..e11e2e30a3 100644 --- a/src/lib/ecore_wl2/ecore_wl2_window.c +++ b/src/lib/ecore_wl2/ecore_wl2_window.c @@ -739,6 +739,9 @@ ecore_wl2_window_free(Ecore_Wl2_Window *window) if (window->class) eina_stringshare_del(window->class); if (window->role) eina_stringshare_del(window->role); + 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)); @@ -1252,9 +1255,24 @@ 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); + + 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 |