devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=d6ce6a8cd541d21cb6fe5bed910238c0cc1fdd00

commit d6ce6a8cd541d21cb6fe5bed910238c0cc1fdd00
Author: Hosang Kim <hosang12....@samsung.com>
Date:   Wed May 27 10:05:30 2020 -0400

    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 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

-- 


Reply via email to