Py_XINCREF(self->logger);
// Set the logger
- if (self->ctx)
- pakfire_ctx_set_log_callback(self->ctx, Ctx_log_callback, self->logger);
+ pakfire_ctx_set_log_callback(self->ctx, Ctx_log_callback, self->logger);
}
static int Ctx_setup_logging(CtxObject* self) {
}
static void Ctx_dealloc(CtxObject* self) {
- // Reset the logger
- Ctx___set_logger(self, NULL);
+ if (self->ctx) {
+ // Reset the logger
+ pakfire_ctx_set_log_callback(self->ctx, NULL, NULL);
- if (self->ctx)
pakfire_ctx_unref(self->ctx);
+ }
+
+ Py_XDECREF(self->logger);
Py_TYPE(self)->tp_free((PyObject *)self);
}