aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-03 10:35:27 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-03 10:35:27 -0200
commit9eba6bf2e7c78016f14d47f42e8558a1e0fb2370 (patch)
treef9fc0405b32130c0bbffea7bb611765e7768ca44
parenteo: fix compilation without HAVE_BACKTRACE. (diff)
downloadefl-9eba6bf2e7c78016f14d47f42e8558a1e0fb2370.tar.gz
eo: do not use eina_trash when running on valgrind.
This allows valgrind to show when the object was created and deleted.
-rw-r--r--src/Makefile_Eo.am5
-rw-r--r--src/lib/eo/eo.c12
2 files changed, 15 insertions, 2 deletions
diff --git a/src/Makefile_Eo.am b/src/Makefile_Eo.am
index 0bf2453c61..e2551bce88 100644
--- a/src/Makefile_Eo.am
+++ b/src/Makefile_Eo.am
@@ -34,7 +34,10 @@ lib/eo/eo_add_fallback.h \
lib/eo/eo_private.h \
lib/eo/efl_future.c
-lib_eo_libeo_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @EO_CFLAGS@
+lib_eo_libeo_la_CPPFLAGS = \
+-I$(top_builddir)/src/lib/efl \
+@EO_CFLAGS@ \
+@VALGRIND_CFLAGS@
lib_eo_libeo_la_LIBADD = @EO_LIBS@
lib_eo_libeo_la_DEPENDENCIES = @EO_INTERNAL_LIBS@
lib_eo_libeo_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index a540492572..dd6cff6e95 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -26,6 +26,12 @@
#include <execinfo.h>
#endif
+#ifdef HAVE_VALGRIND
+# include <valgrind.h>
+# include <memcheck.h>
+#endif
+static Eina_Bool _eo_trash_bypass = EINA_FALSE;
+
#define EO_CLASS_IDS_FIRST 1
#define EFL_OBJECT_OP_IDS_FIRST 1
@@ -980,7 +986,7 @@ _eo_free(_Eo_Object *obj)
_eo_id_release((Eo_Id) _eo_obj_id_get(obj));
eina_spinlock_take(&klass->objects.trash_lock);
- if (klass->objects.trash_count <= 8)
+ if ((klass->objects.trash_count <= 8) && (EINA_LIKELY(!_eo_trash_bypass)))
{
eina_trash_push(&klass->objects.trash, obj);
klass->objects.trash_count++;
@@ -2027,6 +2033,10 @@ efl_object_init(void)
eina_init();
+#if HAVE_VALGRIND
+ _eo_trash_bypass = RUNNING_ON_VALGRIND;
+#endif
+
_efl_object_main_thread = eina_thread_self();
_eo_sz = EO_ALIGN_SIZE(sizeof(_Eo_Object));