From 1fb93c05654f8caae2a64eefc92fea0fe0c36c5f Mon Sep 17 00:00:00 2001 From: Cary R Date: Mon, 3 Dec 2007 16:44:13 -0800 Subject: [PATCH] Fix call back free problem. This is copied from the development branch. The issue is that calling vpi_free_object should not really free a call back handle since it is the real call back object and doing so will invalidate it. This will likely end with a core dump. --- vvp/vpi_callback.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/vvp/vpi_callback.cc b/vvp/vpi_callback.cc index 935edb40c..fed1b9514 100644 --- a/vvp/vpi_callback.cc +++ b/vvp/vpi_callback.cc @@ -39,12 +39,16 @@ #endif # include +/* +* The vpi_free_object() call to a callback doesn't actually delete +* anything, we instead allow the object to run its course and delete +* itself. The semantics of vpi_free_object for a callback is that it +* deletes the *handle*, and not the object itself, so given the vvp +* implementation, there is nothing to do here. +*/ + static int free_simple_callback(vpiHandle ref) { - assert(ref); - assert(ref->vpi_type); - assert(ref->vpi_type->type_code == vpiCallback); - delete ref; return 1; }