ee engines should not crash when re-setting the same title/name_class

@fix
This commit is contained in:
Mike Blumenkrantz 2015-01-22 14:37:56 -05:00
parent 02594a2519
commit 6a934f703c
5 changed files with 29 additions and 14 deletions

View File

@ -325,6 +325,7 @@ _ecore_evas_title_set(Ecore_Evas *ee, const char *title)
{
INF("ecore evas title set");
if (eina_streq(ee->prop.title, title)) return;
if (ee->prop.title) free(ee->prop.title);
ee->prop.title = NULL;
if (title) ee->prop.title = strdup(title);

View File

@ -692,6 +692,7 @@ _ecore_evas_drm_hide(Ecore_Evas *ee)
static void
_ecore_evas_drm_title_set(Ecore_Evas *ee, const char *title)
{
if (eina_streq(ee->prop.title, title)) return;
if (ee->prop.title) free(ee->prop.title);
ee->prop.title = NULL;
if (title) ee->prop.title = strdup(title);
@ -700,12 +701,18 @@ _ecore_evas_drm_title_set(Ecore_Evas *ee, const char *title)
static void
_ecore_evas_drm_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
{
if (ee->prop.name) free(ee->prop.name);
if (ee->prop.clas) free(ee->prop.clas);
ee->prop.name = NULL;
ee->prop.clas = NULL;
if (n) ee->prop.name = strdup(n);
if (c) ee->prop.clas = strdup(c);
if (!eina_streq(ee->prop.name, n))
{
if (ee->prop.name) free(ee->prop.name);
ee->prop.name = NULL;
if (n) ee->prop.name = strdup(n);
}
if (!eina_streq(ee->prop.clas, c))
{
if (ee->prop.clas) free(ee->prop.clas);
ee->prop.clas = NULL;
if (c) ee->prop.clas = strdup(c);
}
}
static void

View File

@ -1098,6 +1098,7 @@ _ecore_evas_wl_common_title_set(Ecore_Evas *ee, const char *title)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ee) return;
if (eina_streq(ee->prop.title, title)) return;
if (ee->prop.title) free(ee->prop.title);
ee->prop.title = NULL;
if (title) ee->prop.title = strdup(title);
@ -1123,13 +1124,18 @@ _ecore_evas_wl_common_name_class_set(Ecore_Evas *ee, const char *n, const char *
if (!ee) return;
wdata = ee->engine.data;
if (ee->prop.name) free(ee->prop.name);
if (ee->prop.clas) free(ee->prop.clas);
ee->prop.name = NULL;
ee->prop.clas = NULL;
if (n) ee->prop.name = strdup(n);
if (c) ee->prop.clas = strdup(c);
if (!eina_streq(ee->prop.name, n))
{
if (ee->prop.name) free(ee->prop.name);
ee->prop.name = NULL;
if (n) ee->prop.name = strdup(n);
}
if (!eina_streq(ee->prop.clas, c))
{
if (ee->prop.clas) free(ee->prop.clas);
ee->prop.clas = NULL;
if (c) ee->prop.clas = strdup(c);
}
if (ee->prop.clas)
ecore_wl_window_class_name_set(wdata->win, ee->prop.clas);
}

View File

@ -757,7 +757,7 @@ static void
_ecore_evas_win32_title_set(Ecore_Evas *ee, const char *title)
{
INF("ecore evas title set");
if (eina_streq(ee->prop.title, title)) return;
if (ee->prop.title) free(ee->prop.title);
ee->prop.title = NULL;
if (title) ee->prop.title = strdup(title);

View File

@ -2898,6 +2898,7 @@ _ecore_evas_x_activate(Ecore_Evas *ee)
static void
_ecore_evas_x_title_set(Ecore_Evas *ee, const char *t)
{
if (eina_streq(ee->prop.title, t)) return;
if (ee->prop.title) free(ee->prop.title);
ee->prop.title = NULL;
if (!t) return;