From 3b39279dfb986cd248af4c87c1eba3f66869117d Mon Sep 17 00:00:00 2001 From: Stephen 'Okra' Houston Date: Mon, 22 May 2017 13:14:55 -0500 Subject: [PATCH] Pager Gadget: Fix potential crash on screen changes such as screen size change. --- src/modules/pager/gadget/pager.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/modules/pager/gadget/pager.c b/src/modules/pager/gadget/pager.c index 6c36c187e..6ac1e534a 100644 --- a/src/modules/pager/gadget/pager.c +++ b/src/modules/pager/gadget/pager.c @@ -235,7 +235,7 @@ _pager_gadget_created_cb(void *data, Evas_Object *obj, void *event_info EINA_UNU static void _pager_orient(Instance *inst, E_Gadget_Site_Orient orient) { - int aspect_w, aspect_h; + int aspect_w, aspect_h, zone_w = 1, zone_h = 1; if (inst->o_pager) { @@ -252,16 +252,21 @@ _pager_orient(Instance *inst, E_Gadget_Site_Orient orient) inst->pager->invert = EINA_FALSE; } } + if (inst->pager->zone) + { + zone_w = inst->pager->zone->w; + zone_h = inst->pager->zone->h; + } if (inst->pager->invert) { - aspect_w = inst->pager->ynum * inst->pager->zone->w; - aspect_h = inst->pager->xnum * inst->pager->zone->h; + aspect_w = inst->pager->ynum * zone_w; + aspect_h = inst->pager->xnum * zone_h; evas_object_size_hint_aspect_set(inst->o_pager, EVAS_ASPECT_CONTROL_BOTH, aspect_w, aspect_h); } else { - aspect_w = inst->pager->xnum * inst->pager->zone->w; - aspect_h = inst->pager->ynum * inst->pager->zone->h; + aspect_w = inst->pager->xnum * zone_w; + aspect_h = inst->pager->ynum * zone_h; evas_object_size_hint_aspect_set(inst->o_pager, EVAS_ASPECT_CONTROL_BOTH, aspect_w, aspect_h); } }