evas_table: abort when there is already the option struct
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>
Sat, 11 Feb 2017 22:20:22 +0000 (23:20 +0100)
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>
Sat, 11 Feb 2017 23:10:05 +0000 (00:10 +0100)
otherwise we would just reuse that struct. This results in
freeing/writing/reading the memory twice.

This error message should give the dev a tip on what went wrong, instead
of leaving cryptic valgrind messages and crashes.

This fixes the sysinfo desktop gadget in enlightenment.

ref T5173

src/lib/evas/canvas/evas_object_table.c

index 5eea6f9..ca615e6 100644 (file)
@@ -1143,6 +1143,11 @@ _evas_table_pack(Eo *o, Evas_Table_Data *priv, Evas_Object *child, unsigned shor
           }
         optalloc = EINA_TRUE;
      }
+   else
+     {
+        ERR("%p is already added to a table", child);
+        return EINA_FALSE;
+     }
 
    opt->obj = child;
    opt->col = col;