don't crash desktop gadget systrays when adjusting image sizing

desktop gadgets (gadman) do not have a shelf, so derefing that pointer
without checking will guarantee a crash
This commit is contained in:
Mike Blumenkrantz 2015-10-08 12:16:37 -04:00
parent acbf4a79b4
commit 2ab7fed323
1 changed files with 11 additions and 2 deletions

View File

@ -216,6 +216,7 @@ image_scale(Instance_Notifier_Host *notifier_inst, Notifier_Item_Icon *ii)
Evas_Coord sz; Evas_Coord sz;
switch (systray_gadcon_get(notifier_inst->inst)->orient) switch (systray_gadcon_get(notifier_inst->inst)->orient)
{ {
case E_GADCON_ORIENT_FLOAT:
case E_GADCON_ORIENT_HORIZ: case E_GADCON_ORIENT_HORIZ:
case E_GADCON_ORIENT_TOP: case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_BOTTOM: case E_GADCON_ORIENT_BOTTOM:
@ -223,7 +224,11 @@ image_scale(Instance_Notifier_Host *notifier_inst, Notifier_Item_Icon *ii)
case E_GADCON_ORIENT_CORNER_TR: case E_GADCON_ORIENT_CORNER_TR:
case E_GADCON_ORIENT_CORNER_BL: case E_GADCON_ORIENT_CORNER_BL:
case E_GADCON_ORIENT_CORNER_BR: case E_GADCON_ORIENT_CORNER_BR:
sz = systray_gadcon_get(notifier_inst->inst)->shelf->h; if (systray_gadcon_get(notifier_inst->inst)->shelf)
sz = systray_gadcon_get(notifier_inst->inst)->shelf->h;
else
evas_object_geometry_get(notifier_inst->inst->gcc->o_frame ?:
notifier_inst->inst->gcc->o_base, NULL, NULL, NULL, &sz);
break; break;
case E_GADCON_ORIENT_VERT: case E_GADCON_ORIENT_VERT:
@ -234,7 +239,11 @@ image_scale(Instance_Notifier_Host *notifier_inst, Notifier_Item_Icon *ii)
case E_GADCON_ORIENT_CORNER_LB: case E_GADCON_ORIENT_CORNER_LB:
case E_GADCON_ORIENT_CORNER_RB: case E_GADCON_ORIENT_CORNER_RB:
default: default:
sz = systray_gadcon_get(notifier_inst->inst)->shelf->w; if (systray_gadcon_get(notifier_inst->inst)->shelf)
sz = systray_gadcon_get(notifier_inst->inst)->shelf->w;
else
evas_object_geometry_get(notifier_inst->inst->gcc->o_frame ?:
notifier_inst->inst->gcc->o_base, NULL, NULL, &sz, NULL);
break; break;
} }
sz = sz - 5; sz = sz - 5;