summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-08-26 14:17:26 +0100
committerTom Hacohen <tom@stosb.com>2015-08-26 14:17:28 +0100
commitd6b18c1e25152ddce179b382fa809c2440eb864a (patch)
tree0786bd1976f572f988fe424b32a2e5c444e375e4
parentacc158a2bfb2f1f1edc587386d7f0ac5ed456e20 (diff)
Eo base: print an error when an object with a parent is destructed.
This should not happen. Objects with parents must have their parents unset before they reach refcount == 0. That's because the parent is the one holding the refcount. This means that if we get to the destructor (object is deleted) while a parent is still set, we have an error scenario.
-rw-r--r--src/lib/eo/eo_base_class.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index bbdf426ee7..77a4bf1005 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -993,9 +993,7 @@ _eo_base_destructor(Eo *obj, Eo_Base_Data *pd)
993 993
994 if (pd->parent) 994 if (pd->parent)
995 { 995 {
996 /* If we have a parent still at the time of destruction, it means that 996 ERR("Object '%p' still has a parent at the time of destruction.", obj);
997 * ref was already (arguably erroneously unrefed) so we need to ref
998 * before it gets unrefed again. */
999 eo_ref(obj); 997 eo_ref(obj);
1000 eo_do(obj, eo_parent_set(NULL)); 998 eo_do(obj, eo_parent_set(NULL));
1001 } 999 }