bugfix in buffer object. Didn't increase the refcount when slicing

This commit is contained in:
Francesco Cozzuto
2023-01-12 16:11:53 +01:00
parent a56a302fd0
commit 189bfa030b
14 changed files with 117 additions and 315 deletions
+16 -1
View File
@@ -82,7 +82,7 @@ static _Bool interpret(Executable *exe)
CompilationErrorType errtyp;
Executable *prelude_exe = compile(prelude, (Error*) &error, &errtyp);
if(exe == NULL) {
if(prelude_exe == NULL) {
const char *errname;
switch(errtyp) {
default:
@@ -109,6 +109,21 @@ static _Bool interpret(Executable *exe)
}
Object *noja_bins = rets[0];
// Need to remake the native built-ins because
// running the script invalidated the previous
// pointer.
native_bins = Object_NewStaticMap(bins_basic, bins_basic_init, runt, (Error*) &error);
if(native_bins == NULL)
{
assert(error.base.occurred == 1);
print_error(NULL, (Error*) &error);
RuntimeError_Free(&error);
Runtime_Free(runt);
Source_Free(prelude);
Executable_Free(prelude_exe);
return 0;
}
Object *all_bins = Object_NewClosure(native_bins, noja_bins, Runtime_GetHeap(runt), (Error*) &error);
if (all_bins == NULL) {
print_error(NULL, (Error*) &error);