Refactor to pure refcount for PERL_SCRIPT_REC

This commit is contained in:
aquanight 2020-07-05 17:20:08 -06:00
commit 26f3049a86
5 changed files with 24 additions and 22 deletions

View file

@ -78,7 +78,7 @@ static int perl_source_event(PERL_SOURCE_REC *rec)
PUTBACK;
perl_source_ref(rec);
perl_script_enter(rec->script);
perl_script_ref(rec->script);
perl_call_sv(rec->func, G_EVAL|G_DISCARD);
if (SvTRUE(ERRSV)) {
@ -87,7 +87,7 @@ static int perl_source_event(PERL_SOURCE_REC *rec)
g_free(error);
}
perl_script_exit(rec->script);
perl_script_unref(rec->script);
if (perl_source_unref(rec) && rec->once)
perl_source_destroy(rec);
@ -107,7 +107,6 @@ int perl_timeout_add(int msecs, SV *func, SV *data, int once)
pkg = perl_get_package();
script = perl_script_find_package(pkg);
g_return_val_if_fail(script != NULL, -1);
g_return_val_if_fail(!script->unloaded, -1);
rec = g_new0(PERL_SOURCE_REC, 1);
perl_source_ref(rec);
@ -131,7 +130,6 @@ int perl_input_add(int source, int condition, SV *func, SV *data, int once)
pkg = perl_get_package();
script = perl_script_find_package(pkg);
g_return_val_if_fail(script != NULL, -1);
g_return_val_if_fail(!script->unloaded, -1);
rec = g_new0(PERL_SOURCE_REC, 1);
perl_source_ref(rec);