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:
parent
bdb900b25f
commit
1fb93c0565
|
|
@ -39,12 +39,16 @@
|
||||||
#endif
|
#endif
|
||||||
# include <stdlib.h>
|
# 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)
|
static int free_simple_callback(vpiHandle ref)
|
||||||
{
|
{
|
||||||
assert(ref);
|
|
||||||
assert(ref->vpi_type);
|
|
||||||
assert(ref->vpi_type->type_code == vpiCallback);
|
|
||||||
delete ref;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue