Allow API usage in native_free_callbacks (#3515)

This patch allows the use of API functions in native_free_callbacks for native pointers once again.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
This commit is contained in:
Daniel Balla
2020-01-18 10:05:32 +01:00
committed by Dániel Bátyai
parent 71d4e12105
commit f46d061d19
7 changed files with 96 additions and 15 deletions
+3 -2
View File
@@ -447,7 +447,7 @@ typedef jerry_value_t (*jerry_external_handler_t) (const jerry_value_t function_
Native free callback of an object. It is used in `jerry_object_native_info_t` and for external Array buffers.
*Note*:
- This callback method **must not** call any JerryScript API methods.
- Referred values by this method must have at least 1 reference. (Correct API usage satisfies this condition)
**Prototype**
@@ -456,6 +456,7 @@ typedef void (*jerry_object_native_free_callback_t) (void *native_p);
```
*New in version 2.0*: Renamed from `jerry_object_free_callback_t`.
*Changed in version 2.2*: API calls are once again allowed. (See note)
**See also**
@@ -6145,7 +6146,7 @@ You can get them by calling [jerry_get_object_native_pointer](#jerry_get_object_
it will be called by the garbage collector when the object is freed.
- If the object is only referenced via the "global" object (or one of it's "child"),
the free callback will be invoked during the execution of `jerry_cleanup`.
- The free callback **must not** invoke API functions.
- The free callback can invoke API functions.
*Note*: If possible do not store API values in native pointers, rather check
[jerry_set_internal_property](#jerry_set_internal_property).