summaryrefslogtreecommitdiff
path: root/legacy/eobj
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2012-06-07 10:54:17 +0000
committerTom Hacohen <tom@stosb.com>2012-06-07 10:54:17 +0000
commit4cd64fc85a6e203d1be83fb48d4379e6f72a417b (patch)
tree0538266ef777b97225d31bcc3b11a0bf6cdb84ae /legacy/eobj
parent84d2f4c32248786e5bc39ef3057267aebf1c80b6 (diff)
Eo: Added some hierarchy reference checks.
Check that objects are freed when they should be freed. SVN revision: 71795
Diffstat (limited to 'legacy/eobj')
-rw-r--r--legacy/eobj/tests/eo_test_general.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/legacy/eobj/tests/eo_test_general.c b/legacy/eobj/tests/eo_test_general.c
index e1d5bfafbe..12f79dd06a 100644
--- a/legacy/eobj/tests/eo_test_general.c
+++ b/legacy/eobj/tests/eo_test_general.c
@@ -216,10 +216,30 @@ START_TEST(eo_refs)
216 fail_if(eo_ref_get(obj) != 1); 216 fail_if(eo_ref_get(obj) != 1);
217#endif 217#endif
218 218
219 /* Check we don't seg if there's an extra xref. */
220 eo_xref(obj, obj2);
221 eo_unref(obj);
222
219 eo_unref(obj); 223 eo_unref(obj);
220 eo_unref(obj2); 224 eo_unref(obj2);
221 eo_unref(obj3); 225 eo_unref(obj3);
222 226
227 /* Check hierarchy */
228 obj = eo_add(SIMPLE_CLASS, NULL);
229 obj2 = eo_add(SIMPLE_CLASS, obj);
230
231 Eo *wref;
232 eo_do(obj2, eo_wref_add(&wref));
233 fail_if(!wref);
234
235 eo_unref(obj2);
236
237 fail_if(!wref); /* Parent is still holding a reference. */
238
239 eo_unref(obj);
240
241 fail_if(wref);
242
223 /* Just check it doesn't seg atm. */ 243 /* Just check it doesn't seg atm. */
224 obj = eo_add(SIMPLE_CLASS, NULL); 244 obj = eo_add(SIMPLE_CLASS, NULL);
225 eo_ref(obj); 245 eo_ref(obj);