Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
#include <pakfire/archive.h>
#include <pakfire/constants.h>
#include <pakfire/archive.h>
#include <pakfire/constants.h>
+#include <pakfire/ctx.h>
#include <pakfire/dependencies.h>
#include <pakfire/digest.h>
#include <pakfire/file.h>
#include <pakfire/dependencies.h>
#include <pakfire/digest.h>
#include <pakfire/file.h>
#include <pakfire/util.h>
struct pakfire_package {
#include <pakfire/util.h>
struct pakfire_package {
+ struct pakfire_ctx* ctx;
struct pakfire* pakfire;
int nrefs;
struct pakfire* pakfire;
int nrefs;
+ // Store a reference to the context
+ pkg->ctx = pakfire_ctx(pakfire);
+
pkg->pakfire = pakfire_ref(pakfire);
pkg->nrefs = 1;
pkg->pakfire = pakfire_ref(pakfire);
pkg->nrefs = 1;
static void pakfire_package_free(struct pakfire_package* pkg) {
if (pkg->repo)
pakfire_repo_unref(pkg->repo);
static void pakfire_package_free(struct pakfire_package* pkg) {
if (pkg->repo)
pakfire_repo_unref(pkg->repo);
-
- pakfire_unref(pkg->pakfire);
+ if (pkg->pakfire)
+ pakfire_unref(pkg->pakfire);
+ if (pkg->ctx)
+ pakfire_ctx_unref(pkg->ctx);