glnx_release_lock_file (&self->lock);
- if (self->sysroot_fd != -1)
- (void) close (self->sysroot_fd);
+ (void) ostree_sysroot_unload (self);
G_OBJECT_CLASS (ostree_sysroot_parent_class)->finalize (object);
}
return self->sysroot_fd;
}
+/**
+ * ostree_sysroot_unload:
+ * @self: Sysroot
+ *
+ * Release any resources such as file descriptors referring to the
+ * root directory of this sysroot. Normally, those resources are
+ * cleared by finalization, but in garbage collected languages that
+ * may not be predictable.
+ *
+ * This undoes the effect of `ostree_sysroot_load()`.
+ */
+void
+ostree_sysroot_unload (OstreeSysroot *self)
+{
+ if (self->sysroot_fd != -1)
+ (void) close (self->sysroot_fd);
+}
+
/**
* ostree_sysroot_ensure_initialized:
* @self: Sysroot
GCancellable *cancellable,
GError **error);
+void ostree_sysroot_unload (OstreeSysroot *self);
+
gboolean ostree_sysroot_ensure_initialized (OstreeSysroot *self,
GCancellable *cancellable,
GError **error);