Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_widget.c 


Log Message:
- make sure we don't leak any path/group references
- if there is no path or group in the theme then make sure we remove it from
  the widget

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_widget.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -3 -r1.112 -r1.113
--- ewl_widget.c        2 Jan 2007 16:16:31 -0000       1.112
+++ ewl_widget.c        3 Jan 2007 21:11:06 -0000       1.113
@@ -2490,8 +2490,35 @@
        i = ewl_theme_image_get(w, "file");
        group = ewl_theme_data_str_get(w, "group");
 
-       if (i) w->theme_path = ecore_string_instance(i);
-       if (group) w->theme_group = ecore_string_instance(group);
+       if (i) {
+               const char *t;
+
+               t = w->theme_path;
+               w->theme_path = ecore_string_instance(i);
+
+               /* free this after, if it's the same string we dont' want to
+                * release all references on it */
+               if (t) ecore_string_release(t);
+
+       } else if (w->theme_path) {
+               ecore_string_release(w->theme_path);
+               w->theme_path = NULL;
+       }
+
+       if (group) {
+               const char *t;
+
+               t = w->theme_group;
+               w->theme_group = ecore_string_instance(group);
+               
+               /* free this after, if it's the same string we dont' want to
+                * release all references on it */
+               if (t) ecore_string_release(t);
+
+       } else if (w->theme_group) {
+               ecore_string_release(w->theme_group);
+               w->theme_group = NULL;
+       }
 
        IF_FREE(i);
        IF_FREE(group);



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to