mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-09-06 09:07:15 +02:00
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:
+8
-4
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user