Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        container.c 


Log Message:
Fix segv when creating second systray.

===================================================================
RCS file: /cvs/e/e16/e/src/container.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- container.c 28 Aug 2006 22:32:48 -0000      1.1
+++ container.c 5 Oct 2006 19:04:23 -0000       1.2
@@ -50,11 +50,26 @@
 
 Ecore_List         *container_list = NULL;
 
+static int
+_ContainerMatchName(const void *data, const void *match)
+{
+   return strcmp(((const Container *)data)->name, match);
+}
+
+static Container   *
+ContainerFind(const char *name)
+{
+   return ecore_list_find(container_list, _ContainerMatchName, name);
+}
+
 static Container   *
 ContainerCreate(const char *name)
 {
    Container          *ct;
 
+   if (ContainerFind(name))
+      return NULL;
+
    ct = Ecalloc(1, sizeof(Container));
    if (!ct)
       return NULL;
@@ -64,7 +79,7 @@
    ecore_list_append(container_list, ct);
 
    ct->name = Estrdup(name);
-   ct->type = (name && !strncmp(name, "_ST_", 4)) ?
+   ct->type = (name && !strcmp(name, "_ST_")) ?
       IB_TYPE_SYSTRAY : IB_TYPE_ICONBOX;
    ct->orientation = 0;
    ct->scrollbar_side = 1;
@@ -169,18 +184,6 @@
       ContainersConfigSave();
 }
 
-static int
-_ContainerMatchName(const void *data, const void *match)
-{
-   return strcmp(((const Container *)data)->name, match);
-}
-
-static Container   *
-ContainerFind(const char *name)
-{
-   return ecore_list_find(container_list, _ContainerMatchName, name);
-}
-
 static void
 ContainerReconfigure(Container * ct)
 {
@@ -291,6 +294,9 @@
 ContainerShow(Container * ct)
 {
    EWin               *ewin;
+
+   if (!ct)
+      return;
 
    HintsSetWindowName(ct->win, ct->wm_name);
    HintsSetWindowClass(ct->win, ct->name, "Enlightenment_IconBox");



-------------------------------------------------------------------------
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