forked from enlightenment/enlightenment
E: Potentially fix segfault with adding/removing desktop names and
using the tiling module. Use eina_stringshare_replace where possible. Fix some formatting. Set desk->name to NULL if we are not going to put a string into it. SVN revision: 63564
This commit is contained in:
parent
942b27687d
commit
933a6d3d71
|
@ -48,7 +48,7 @@ e_desk_new(E_Zone *zone, int x, int y)
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
E_Config_Desktop_Name *cfname;
|
E_Config_Desktop_Name *cfname;
|
||||||
char name[40];
|
char name[40];
|
||||||
int ok;
|
int ok = 0;
|
||||||
|
|
||||||
E_OBJECT_CHECK_RETURN(zone, NULL);
|
E_OBJECT_CHECK_RETURN(zone, NULL);
|
||||||
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
|
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, NULL);
|
||||||
|
@ -61,7 +61,6 @@ e_desk_new(E_Zone *zone, int x, int y)
|
||||||
desk->y = y;
|
desk->y = y;
|
||||||
|
|
||||||
/* Get current desktop's name */
|
/* Get current desktop's name */
|
||||||
ok = 0;
|
|
||||||
EINA_LIST_FOREACH(e_config->desktop_names, l, cfname)
|
EINA_LIST_FOREACH(e_config->desktop_names, l, cfname)
|
||||||
{
|
{
|
||||||
if ((cfname->container >= 0) &&
|
if ((cfname->container >= 0) &&
|
||||||
|
@ -91,8 +90,8 @@ e_desk_name_set(E_Desk *desk, const char *name)
|
||||||
|
|
||||||
E_OBJECT_CHECK(desk);
|
E_OBJECT_CHECK(desk);
|
||||||
E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
|
E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
|
||||||
if (desk->name) eina_stringshare_del(desk->name);
|
|
||||||
desk->name = eina_stringshare_add(name);
|
eina_stringshare_replace(&desk->name, name);
|
||||||
|
|
||||||
ev = E_NEW(E_Event_Desk_Name_Change, 1);
|
ev = E_NEW(E_Event_Desk_Name_Change, 1);
|
||||||
ev->desk = desk;
|
ev->desk = desk;
|
||||||
|
@ -107,12 +106,14 @@ e_desk_name_add(int container, int zone, int desk_x, int desk_y, const char *nam
|
||||||
E_Config_Desktop_Name *cfname;
|
E_Config_Desktop_Name *cfname;
|
||||||
|
|
||||||
e_desk_name_del(container, zone, desk_x, desk_y);
|
e_desk_name_del(container, zone, desk_x, desk_y);
|
||||||
|
|
||||||
cfname = E_NEW(E_Config_Desktop_Name, 1);
|
cfname = E_NEW(E_Config_Desktop_Name, 1);
|
||||||
cfname->container = container;
|
cfname->container = container;
|
||||||
cfname->zone = zone;
|
cfname->zone = zone;
|
||||||
cfname->desk_x = desk_x;
|
cfname->desk_x = desk_x;
|
||||||
cfname->desk_y = desk_y;
|
cfname->desk_y = desk_y;
|
||||||
if (name) cfname->name = eina_stringshare_add(name);
|
if (name) cfname->name = eina_stringshare_add(name);
|
||||||
|
else cfname->name = NULL;
|
||||||
e_config->desktop_names = eina_list_append(e_config->desktop_names, cfname);
|
e_config->desktop_names = eina_list_append(e_config->desktop_names, cfname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +131,7 @@ e_desk_name_del(int container, int zone, int desk_x, int desk_y)
|
||||||
e_config->desktop_names =
|
e_config->desktop_names =
|
||||||
eina_list_remove_list(e_config->desktop_names, l);
|
eina_list_remove_list(e_config->desktop_names, l);
|
||||||
if (cfname->name) eina_stringshare_del(cfname->name);
|
if (cfname->name) eina_stringshare_del(cfname->name);
|
||||||
free(cfname);
|
E_FREE(cfname);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,7 +170,7 @@ e_desk_name_update(void)
|
||||||
((int) zone->num != cfname->zone)) continue;
|
((int) zone->num != cfname->zone)) continue;
|
||||||
if ((cfname->desk_x != d_x) ||
|
if ((cfname->desk_x != d_x) ||
|
||||||
(cfname->desk_y != d_y)) continue;
|
(cfname->desk_y != d_y)) continue;
|
||||||
e_desk_name_set(desk,cfname->name);
|
e_desk_name_set(desk, cfname->name);
|
||||||
ok = 1;
|
ok = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +180,7 @@ e_desk_name_update(void)
|
||||||
snprintf(name, sizeof(name),
|
snprintf(name, sizeof(name),
|
||||||
_(e_config->desktop_default_name),
|
_(e_config->desktop_default_name),
|
||||||
d_x, d_y);
|
d_x, d_y);
|
||||||
e_desk_name_set(desk,name);
|
e_desk_name_set(desk, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -517,7 +518,9 @@ static void
|
||||||
_e_desk_free(E_Desk *desk)
|
_e_desk_free(E_Desk *desk)
|
||||||
{
|
{
|
||||||
if (desk->name) eina_stringshare_del(desk->name);
|
if (desk->name) eina_stringshare_del(desk->name);
|
||||||
|
desk->name = NULL;
|
||||||
if (desk->animator) ecore_animator_del(desk->animator);
|
if (desk->animator) ecore_animator_del(desk->animator);
|
||||||
|
desk->animator = NULL;
|
||||||
free(desk);
|
free(desk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue