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.
This commit is contained in:
Cary R 2007-12-03 16:44:13 -08:00 committed by Stephen Williams
parent bdb900b25f
commit 1fb93c0565
1 changed files with 8 additions and 4 deletions

View File

@ -39,12 +39,16 @@
#endif
# include <stdlib.h>
/*
* 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;
}