1
0
forked from GitHub/gf-core

bugfixes related to old pointers

This commit is contained in:
Krasimir Angelov
2022-10-24 10:37:38 +02:00
parent d8aab2962c
commit 39ac59c2b9
4 changed files with 13 additions and 1 deletions

View File

@@ -1102,6 +1102,7 @@ fit:
} }
} }
descr = ptr(block_descr, map);
int index = (descr->descr_txn_id != ms->curr_txn_id); int index = (descr->descr_txn_id != ms->curr_txn_id);
descr->chain = free_descriptors[index]; descr->chain = free_descriptors[index];
free_descriptors[index] = map; free_descriptors[index] = map;

View File

@@ -1183,7 +1183,7 @@ PgfRevision pgf_start_transaction(PgfDB *db, PgfExn *err)
new_pgf->major_version = pgf->major_version; new_pgf->major_version = pgf->major_version;
new_pgf->minor_version = pgf->minor_version; new_pgf->minor_version = pgf->minor_version;
new_pgf->gflags = pgf->gflags; new_pgf->gflags = pgf->gflags;
new_pgf->abstract.name = textdup_db(&(*pgf->abstract.name)); new_pgf->abstract.name = textdup_db(ref<PgfText>::from_ptr(&(*pgf->abstract.name)));
new_pgf->abstract.aflags = pgf->abstract.aflags; new_pgf->abstract.aflags = pgf->abstract.aflags;
new_pgf->abstract.funs = pgf->abstract.funs; new_pgf->abstract.funs = pgf->abstract.funs;
new_pgf->abstract.cats = pgf->abstract.cats; new_pgf->abstract.cats = pgf->abstract.cats;

View File

@@ -92,6 +92,14 @@ ref<PgfText> textdup_db(PgfText *t1)
return t2; return t2;
} }
PGF_INTERNAL
ref<PgfText> textdup_db(ref<PgfText> t1)
{
ref<PgfText> t2 = PgfDB::malloc<PgfText>(t1->size+1);
memcpy(&(*t2), &(*t1), sizeof(PgfText)+t1->size+1);
return t2;
}
PGF_INTERNAL PGF_INTERNAL
void text_db_release(ref<PgfText> text) void text_db_release(ref<PgfText> text)
{ {

View File

@@ -23,6 +23,9 @@ PgfText* textdup(PgfText *t1);
PGF_INTERNAL_DECL PGF_INTERNAL_DECL
ref<PgfText> textdup_db(PgfText *t1); ref<PgfText> textdup_db(PgfText *t1);
PGF_INTERNAL_DECL
ref<PgfText> textdup_db(ref<PgfText> t1);
PGF_INTERNAL PGF_INTERNAL
void text_db_release(ref<PgfText> text); void text_db_release(ref<PgfText> text);