]> git.ipfire.org Git - pakfire.git/commitdiff
repo: Reference context when re-fetching a repository
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Oct 2023 09:07:47 +0000 (09:07 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Oct 2023 09:07:47 +0000 (09:07 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/repo.c

index 73ee11e59f1705137b6bf0c5b0ed3d0832267b75..6b163d2d1056c9ba6fa63788358a79df0f489af8 100644 (file)
@@ -840,10 +840,15 @@ ERROR:
 struct pakfire_repo* pakfire_repo_create_from_repo(struct pakfire* pakfire, Repo* r) {
        struct pakfire_repo* repo = calloc(1, sizeof(*repo));
        if (repo) {
-               repo->nrefs = 1;
+               // Store a reference to the context
+               repo->ctx = pakfire_ctx(pakfire);
 
+               // Store a reference to Pakfire
                repo->pakfire = pakfire_ref(pakfire);
 
+               // Initialize the reference counter
+               repo->nrefs = 1;
+
                // Reference repository
                repo->repo = r;
                repo->appdata = r->appdata;