ee engines should not crash when re-setting the same title/name_class
authorMike Blumenkrantz <zmike@osg.samsung.com>
Thu, 22 Jan 2015 19:37:56 +0000 (14:37 -0500)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Thu, 22 Jan 2015 19:39:10 +0000 (14:39 -0500)
@fix

src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
src/modules/ecore_evas/engines/x/ecore_evas_x.c

index 2c0d724..f66b7be 100644 (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);
index 7e458e1..40ec670 100644 (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
index 76036c3..424a5aa 100644 (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);
 }
index 88397c7..9333455 100644 (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);
index a128e7c..a401d46 100644 (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;