Hi everybody,

There's a minor bug in ecore_config.c
(e17/libs/ecore/src/lib/ecore_config), causing problems with deleting items.

The problem is that the iterator is initialized to the element which is
searched for, and the linked list is traversed from there, so the
element itself will never be found, and therefor not be removed from the
list. After that, the element will be destroyed, destroying the linked list.

The attached patch changes the initialization to the beginning of the
linked list instead.

Before:

[~/ecore]>ecore_config -c dummy.cfg -k /test1 -s test1
string    "test1"
[~/ecore]>ecore_config -c dummy.cfg -k /test2 -s test2
string    "test2"
[~/ecore]>ecore_config -c dummy.cfg -k /test3 -s test3
string    "test3"
[~/ecore]>ecore_config -c dummy.cfg -a
/test1                          string    "test1"
/test2                          string    "test2"
/test3                          string    "test3"
[~/ecore]>ecore_config -c dummy.cfg -k /test2 -d
Segmentation fault
[~/ecore]>ecore_config -c dummy.cfg -a
[~/ecore]>

After:

[~/ecore]>ecore_config -c dummy.cfg -k /test1 -s test1
string    "test1"
[~/ecore]>ecore_config -c dummy.cfg -k /test2 -s test2
string    "test2"
[~/ecore]>ecore_config -c dummy.cfg -k /test3 -s test3
string    "test3"
[~/ecore]>ecore_config -c dummy.cfg -a
/test1                          string    "test1"
/test2                          string    "test2"
/test3                          string    "test3"
[~/ecore]>ecore_config -c dummy.cfg -k /test2 -d
[~/ecore]>ecore_config -c dummy.cfg -a
/test1                          string    "test1"
/test3                          string    "test3"
[~/ecore]>

Regards,
Chris
--- ecore_config.c.orig 2007-04-27 13:14:49.000000000 +0200
+++ ecore_config.c      2007-04-27 13:18:35.000000000 +0200
@@ -53,8 +53,8 @@
    Ecore_Config_Listener_List *l;
 
    p = NULL;
-   c = e;
    t = __ecore_config_bundle_local;
+   c = t->data;
 
    if (!e || !e->key)
       return NULL;
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to