MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / managed_finalizer

Function managed_finalizer

Source/Utils/dukglue/detail_constructor.h:37–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36 template <typename Cls>
37 static duk_ret_t managed_finalizer(duk_context* ctx)
38 {
39 duk_get_prop_string(ctx, 0, "\xFF" "obj_ptr");
40 Cls* obj = (Cls*) duk_require_pointer(ctx, -1);
41 duk_pop(ctx); // pop obj_ptr
42
43 if (obj != NULL) {
44 delete obj;
45
46 // for safety, set the pointer to undefined
47 duk_push_undefined(ctx);
48 duk_put_prop_string(ctx, 0, "\xFF" "obj_ptr");
49 }
50
51 return 0;
52 }
53
54 template<typename Cls>
55 static duk_ret_t call_native_deleter(duk_context* ctx)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected