Skip to content

Commit

Permalink
Fix v8 bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name authored and oleavr committed Feb 12, 2024
1 parent 1c36def commit 72c3403
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions bindings/gumjs/gumv8process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct GumV8FindModuleByNameContext
struct GumV8RunOnThreadContext
{
GumV8Core * core;
Local<Function> user_func;
Global<Function> user_func;
};

GUMJS_DECLARE_GETTER (gumjs_process_get_main_module)
Expand Down Expand Up @@ -548,11 +548,11 @@ GUMJS_DEFINE_FUNCTION (gumjs_process_run_on_thread)
if (module->stalker == NULL)
module->stalker = gum_stalker_new ();

context.core = core;
context.user_func = Global<Function> (isolate, user_func);

{
ScriptUnlocker unlocker (core);
context.core = core;
context.user_func = Local<Function>::New (isolate, user_func);

run = gum_stalker_run_on_thread (module->stalker, thread_id,
gum_js_process_run_cb, &context);
}
Expand All @@ -574,13 +574,14 @@ gum_js_process_run_cb (const GumCpuContext * cpu_context,
{
GumV8RunOnThreadContext * context = (GumV8RunOnThreadContext *) user_data;
auto core = context->core;
auto isolate = core->isolate;
auto ctx = isolate->GetCurrentContext ();

ScriptScope scope (core->script);
auto recv = Undefined (isolate);

auto result = context->user_func->Call (ctx, recv, 0, nullptr);
auto isolate = core->isolate;
auto user_func = Local<Function>::New (isolate, context->user_func);
auto ctx = isolate->GetCurrentContext ();
auto recv = Undefined (isolate);
auto result = user_func->Call (ctx, recv, 0, nullptr);
(void) result;
}

Expand Down

0 comments on commit 72c3403

Please sign in to comment.