Improve message when ctx is freed, but still referenced
authorTobias Grosser <tobias@grosser.es>
Thu, 1 Dec 2011 14:15:45 +0000 (15:15 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 3 Dec 2011 19:08:14 +0000 (20:08 +0100)
Instead of a cryptic 'Assertion "ctx->ref == 0" failed' we report
'isl_ctx freed, but some objects still reference it'.

Signed-off-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_ctx.c

index bea6efb..b5d5fcf 100644 (file)
--- a/isl_ctx.c
+++ b/isl_ctx.c
@@ -132,7 +132,11 @@ void isl_ctx_free(struct isl_ctx *ctx)
 {
        if (!ctx)
                return;
-       isl_assert(ctx, ctx->ref == 0, return);
+       if (ctx->ref != 0)
+               isl_die(ctx, isl_error_invalid,
+                       "isl_ctx freed, but some objects still reference it",
+                       return);
+
        isl_hash_table_clear(&ctx->id_table);
        isl_blk_clear_cache(ctx);
        isl_int_clear(ctx->zero);