[PATCH] ivi-controller: do refactor send_layer_add_event

Natsume, Wataru (ADITJ/SWG) wnatsume at jp.adit-jv.com
Tue May 31 07:32:10 EDT 2016


Check logic should be improved because iviscrn is never null.
Besides, do not iterate over empty list like send_surface_add_event

Signed-off-by: Wataru Natsume <wataru_natsume at xddp.denso.co.jp>
---
 weston-ivi-shell/src/ivi-controller-impl.c |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/weston-ivi-shell/src/ivi-controller-impl.c b/weston-ivi-shell/src/ivi-controller-impl.c
index b5087fc..b3f56b2 100644
--- a/weston-ivi-shell/src/ivi-controller-impl.c
+++ b/weston-ivi-shell/src/ivi-controller-impl.c
@@ -295,22 +295,26 @@ send_layer_add_event(struct ivilayer *ivilayer,
     else if (mask & IVI_NOTIFICATION_ADD) {
         for (i = 0; i < (int)length; i++) {
             /* Send new layer event */
-            iviscrn = NULL;
+            if (wl_list_empty(&shell->list_screen)) {
+                    break;
+            }
+
+            int found = 0;
             wl_list_for_each(iviscrn, &shell->list_screen, link) {
                 if (iviscrn->layout_screen == pArray[i]) {
+                    found = 1;
                     break;
                 }
             }
 
-            if (iviscrn == NULL) {
-                continue;
-            }
 
-            resource_output =
-                wl_resource_find_for_client(&iviscrn->output->resource_list,
-                                     client);
-            if (resource_output != NULL) {
-                ivi_controller_layer_send_screen(resource, resource_output);
+            if (found == 1) {
+                resource_output =
+                    wl_resource_find_for_client(&iviscrn->output->resource_list,
+                                         client);
+                if (resource_output != NULL) {
+                    ivi_controller_layer_send_screen(resource, resource_output);
+                }
             }
         }
     }
-- 
1.7.9.5

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ivi-controller-do-refactor-send_layer_add_event.patch
Type: application/octet-stream
Size: 2117 bytes
Desc: 0001-ivi-controller-do-refactor-send_layer_add_event.patch
URL: <http://lists.genivi.org/pipermail/genivi-ivi-layer-management_lists.genivi.org/attachments/20160531/a1d6bd8f/attachment.patch>


More information about the genivi-ivi-layer-management mailing list