mirror of
https://gitlab.gnome.org/GNOME/libsecret.git
synced 2024-12-22 12:48:51 +00:00
Reference nonstatic schemas when we put them in a closure
This commit is contained in:
parent
60f6e8e770
commit
fda4704c56
@ -51,6 +51,7 @@ static void
|
|||||||
store_closure_free (gpointer data)
|
store_closure_free (gpointer data)
|
||||||
{
|
{
|
||||||
StoreClosure *closure = data;
|
StoreClosure *closure = data;
|
||||||
|
_secret_schema_unref_if_nonstatic (closure->schema);
|
||||||
g_hash_table_unref (closure->attributes);
|
g_hash_table_unref (closure->attributes);
|
||||||
g_free (closure->collection_path);
|
g_free (closure->collection_path);
|
||||||
g_free (closure->label);
|
g_free (closure->label);
|
||||||
@ -207,7 +208,7 @@ secret_password_storev (const SecretSchema *schema,
|
|||||||
res = g_simple_async_result_new (NULL, callback, user_data,
|
res = g_simple_async_result_new (NULL, callback, user_data,
|
||||||
secret_password_storev);
|
secret_password_storev);
|
||||||
closure = g_slice_new0 (StoreClosure);
|
closure = g_slice_new0 (StoreClosure);
|
||||||
closure->schema = schema;
|
closure->schema = _secret_schema_ref_if_nonstatic (schema);
|
||||||
closure->collection_path = g_strdup (collection_path);
|
closure->collection_path = g_strdup (collection_path);
|
||||||
closure->label = g_strdup (label);
|
closure->label = g_strdup (label);
|
||||||
closure->value = secret_value_new (password, -1, "text/plain");
|
closure->value = secret_value_new (password, -1, "text/plain");
|
||||||
@ -380,6 +381,7 @@ static void
|
|||||||
lookup_closure_free (gpointer data)
|
lookup_closure_free (gpointer data)
|
||||||
{
|
{
|
||||||
LookupClosure *closure = data;
|
LookupClosure *closure = data;
|
||||||
|
_secret_schema_unref_if_nonstatic (closure->schema);
|
||||||
g_clear_object (&closure->cancellable);
|
g_clear_object (&closure->cancellable);
|
||||||
g_hash_table_unref (closure->attributes);
|
g_hash_table_unref (closure->attributes);
|
||||||
if (closure->value)
|
if (closure->value)
|
||||||
@ -511,7 +513,7 @@ secret_password_lookupv (const SecretSchema *schema,
|
|||||||
res = g_simple_async_result_new (NULL, callback, user_data,
|
res = g_simple_async_result_new (NULL, callback, user_data,
|
||||||
secret_password_lookupv);
|
secret_password_lookupv);
|
||||||
closure = g_slice_new0 (LookupClosure);
|
closure = g_slice_new0 (LookupClosure);
|
||||||
closure->schema = schema;
|
closure->schema = _secret_schema_ref_if_nonstatic (schema);
|
||||||
closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
||||||
closure->attributes = _secret_util_attributes_copy (attributes);
|
closure->attributes = _secret_util_attributes_copy (attributes);
|
||||||
g_simple_async_result_set_op_res_gpointer (res, closure, lookup_closure_free);
|
g_simple_async_result_set_op_res_gpointer (res, closure, lookup_closure_free);
|
||||||
@ -811,6 +813,7 @@ delete_closure_free (gpointer data)
|
|||||||
DeleteClosure *closure = data;
|
DeleteClosure *closure = data;
|
||||||
g_clear_object (&closure->cancellable);
|
g_clear_object (&closure->cancellable);
|
||||||
g_hash_table_unref (closure->attributes);
|
g_hash_table_unref (closure->attributes);
|
||||||
|
_secret_schema_unref_if_nonstatic (closure->schema);
|
||||||
g_slice_free (DeleteClosure, closure);
|
g_slice_free (DeleteClosure, closure);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -937,7 +940,7 @@ secret_password_removev (const SecretSchema *schema,
|
|||||||
res = g_simple_async_result_new (NULL, callback, user_data,
|
res = g_simple_async_result_new (NULL, callback, user_data,
|
||||||
secret_password_removev);
|
secret_password_removev);
|
||||||
closure = g_slice_new0 (DeleteClosure);
|
closure = g_slice_new0 (DeleteClosure);
|
||||||
closure->schema = schema;
|
closure->schema = _secret_schema_ref_if_nonstatic (schema);
|
||||||
closure->attributes = _secret_util_attributes_copy (attributes);
|
closure->attributes = _secret_util_attributes_copy (attributes);
|
||||||
closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
closure->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
||||||
g_simple_async_result_set_op_res_gpointer (res, closure, delete_closure_free);
|
g_simple_async_result_set_op_res_gpointer (res, closure, delete_closure_free);
|
||||||
|
@ -28,62 +28,62 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct _SecretSession SecretSession;
|
typedef struct _SecretSession SecretSession;
|
||||||
|
|
||||||
#define SECRET_SERVICE_PATH "/org/freedesktop/secrets"
|
#define SECRET_SERVICE_PATH "/org/freedesktop/secrets"
|
||||||
|
|
||||||
#define SECRET_SERVICE_BUS_NAME "org.freedesktop.Secret.Service"
|
#define SECRET_SERVICE_BUS_NAME "org.freedesktop.Secret.Service"
|
||||||
|
|
||||||
#define SECRET_ITEM_INTERFACE "org.freedesktop.Secret.Item"
|
#define SECRET_ITEM_INTERFACE "org.freedesktop.Secret.Item"
|
||||||
#define SECRET_COLLECTION_INTERFACE "org.freedesktop.Secret.Collection"
|
#define SECRET_COLLECTION_INTERFACE "org.freedesktop.Secret.Collection"
|
||||||
#define SECRET_PROMPT_INTERFACE "org.freedesktop.Secret.Prompt"
|
#define SECRET_PROMPT_INTERFACE "org.freedesktop.Secret.Prompt"
|
||||||
#define SECRET_SERVICE_INTERFACE "org.freedesktop.Secret.Service"
|
#define SECRET_SERVICE_INTERFACE "org.freedesktop.Secret.Service"
|
||||||
|
|
||||||
#define SECRET_PROMPT_SIGNAL_COMPLETED "Completed"
|
#define SECRET_PROMPT_SIGNAL_COMPLETED "Completed"
|
||||||
|
|
||||||
#define SECRET_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
|
#define SECRET_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
|
||||||
|
|
||||||
SecretSync * _secret_sync_new (void);
|
SecretSync * _secret_sync_new (void);
|
||||||
|
|
||||||
void _secret_sync_free (gpointer data);
|
void _secret_sync_free (gpointer data);
|
||||||
|
|
||||||
void _secret_sync_on_result (GObject *source,
|
void _secret_sync_on_result (GObject *source,
|
||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
SecretPrompt * _secret_prompt_instance (SecretService *service,
|
SecretPrompt * _secret_prompt_instance (SecretService *service,
|
||||||
const gchar *prompt_path);
|
const gchar *prompt_path);
|
||||||
|
|
||||||
gchar * _secret_util_parent_path (const gchar *path);
|
gchar * _secret_util_parent_path (const gchar *path);
|
||||||
|
|
||||||
gboolean _secret_util_empty_path (const gchar *path);
|
gboolean _secret_util_empty_path (const gchar *path);
|
||||||
|
|
||||||
GType _secret_list_get_type (void) G_GNUC_CONST;
|
GType _secret_list_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GVariant * _secret_util_variant_for_attributes (GHashTable *attributes);
|
GVariant * _secret_util_variant_for_attributes (GHashTable *attributes);
|
||||||
|
|
||||||
GHashTable * _secret_util_attributes_for_variant (GVariant *variant);
|
GHashTable * _secret_util_attributes_for_variant (GVariant *variant);
|
||||||
|
|
||||||
GHashTable * _secret_util_attributes_for_varargs (const SecretSchema *schema,
|
GHashTable * _secret_util_attributes_for_varargs (const SecretSchema *schema,
|
||||||
va_list va);
|
va_list va);
|
||||||
|
|
||||||
GHashTable * _secret_util_attributes_copy (GHashTable *attributes);
|
GHashTable * _secret_util_attributes_copy (GHashTable *attributes);
|
||||||
|
|
||||||
gboolean _secret_util_attributes_validate (const SecretSchema *schema,
|
gboolean _secret_util_attributes_validate (const SecretSchema *schema,
|
||||||
GHashTable *attributes);
|
GHashTable *attributes);
|
||||||
|
|
||||||
GVariant * _secret_util_variant_for_properties (GHashTable *properties);
|
GVariant * _secret_util_variant_for_properties (GHashTable *properties);
|
||||||
|
|
||||||
void _secret_util_get_properties (GDBusProxy *proxy,
|
void _secret_util_get_properties (GDBusProxy *proxy,
|
||||||
gpointer result_tag,
|
gpointer result_tag,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
gboolean _secret_util_get_properties_finish (GDBusProxy *proxy,
|
gboolean _secret_util_get_properties_finish (GDBusProxy *proxy,
|
||||||
gpointer result_tag,
|
gpointer result_tag,
|
||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
void _secret_util_set_property (GDBusProxy *proxy,
|
void _secret_util_set_property (GDBusProxy *proxy,
|
||||||
const gchar *property,
|
const gchar *property,
|
||||||
GVariant *value,
|
GVariant *value,
|
||||||
gpointer result_tag,
|
gpointer result_tag,
|
||||||
@ -91,63 +91,67 @@ void _secret_util_set_property (GDBusProxy *proxy
|
|||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
gboolean _secret_util_set_property_finish (GDBusProxy *proxy,
|
gboolean _secret_util_set_property_finish (GDBusProxy *proxy,
|
||||||
gpointer result_tag,
|
gpointer result_tag,
|
||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
gboolean _secret_util_set_property_sync (GDBusProxy *proxy,
|
gboolean _secret_util_set_property_sync (GDBusProxy *proxy,
|
||||||
const gchar *property,
|
const gchar *property,
|
||||||
GVariant *value,
|
GVariant *value,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
gboolean _secret_util_have_cached_properties (GDBusProxy *proxy);
|
gboolean _secret_util_have_cached_properties (GDBusProxy *proxy);
|
||||||
|
|
||||||
void _secret_service_set_default_bus_name (const gchar *bus_name);
|
void _secret_service_set_default_bus_name (const gchar *bus_name);
|
||||||
|
|
||||||
SecretSession * _secret_service_get_session (SecretService *self);
|
SecretSession * _secret_service_get_session (SecretService *self);
|
||||||
|
|
||||||
void _secret_service_take_session (SecretService *self,
|
void _secret_service_take_session (SecretService *self,
|
||||||
SecretSession *session);
|
SecretSession *session);
|
||||||
|
|
||||||
void _secret_service_delete_path (SecretService *self,
|
void _secret_service_delete_path (SecretService *self,
|
||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
gboolean is_an_item,
|
gboolean is_an_item,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
SecretItem * _secret_service_find_item_instance (SecretService *self,
|
SecretItem * _secret_service_find_item_instance (SecretService *self,
|
||||||
const gchar *item_path);
|
const gchar *item_path);
|
||||||
|
|
||||||
SecretItem * _secret_collection_find_item_instance (SecretCollection *self,
|
SecretItem * _secret_collection_find_item_instance (SecretCollection *self,
|
||||||
const gchar *item_path);
|
const gchar *item_path);
|
||||||
|
|
||||||
gchar * _secret_value_unref_to_password (SecretValue *value);
|
gchar * _secret_value_unref_to_password (SecretValue *value);
|
||||||
|
|
||||||
gchar * _secret_value_unref_to_string (SecretValue *value);
|
gchar * _secret_value_unref_to_string (SecretValue *value);
|
||||||
|
|
||||||
void _secret_session_free (gpointer data);
|
void _secret_session_free (gpointer data);
|
||||||
|
|
||||||
const gchar * _secret_session_get_algorithms (SecretSession *session);
|
const gchar * _secret_session_get_algorithms (SecretSession *session);
|
||||||
|
|
||||||
const gchar * _secret_session_get_path (SecretSession *session);
|
const gchar * _secret_session_get_path (SecretSession *session);
|
||||||
|
|
||||||
void _secret_session_open (SecretService *service,
|
void _secret_session_open (SecretService *service,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
gboolean _secret_session_open_finish (GAsyncResult *result,
|
gboolean _secret_session_open_finish (GAsyncResult *result,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
GVariant * _secret_session_encode_secret (SecretSession *session,
|
GVariant * _secret_session_encode_secret (SecretSession *session,
|
||||||
SecretValue *value);
|
SecretValue *value);
|
||||||
|
|
||||||
SecretValue * _secret_session_decode_secret (SecretSession *session,
|
SecretValue * _secret_session_decode_secret (SecretSession *session,
|
||||||
GVariant *encoded);
|
GVariant *encoded);
|
||||||
|
|
||||||
|
const SecretSchema * _secret_schema_ref_if_nonstatic (const SecretSchema *schema);
|
||||||
|
|
||||||
|
void _secret_schema_unref_if_nonstatic (const SecretSchema *schema);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __SECRET_PRIVATE_H___ */
|
#endif /* __SECRET_PRIVATE_H___ */
|
||||||
|
@ -242,6 +242,15 @@ secret_schema_ref (SecretSchema *schema)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SecretSchema *
|
||||||
|
_secret_schema_ref_if_nonstatic (const SecretSchema *schema)
|
||||||
|
{
|
||||||
|
if (schema && g_atomic_int_get (&schema->reserved) > 0)
|
||||||
|
secret_schema_ref ((SecretSchema *)schema);
|
||||||
|
|
||||||
|
return schema;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* secret_schema_unref:
|
* secret_schema_unref:
|
||||||
* @schema: the schema to reference
|
* @schema: the schema to reference
|
||||||
@ -273,4 +282,11 @@ secret_schema_unref (SecretSchema *schema)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_secret_schema_unref_if_nonstatic (const SecretSchema *schema)
|
||||||
|
{
|
||||||
|
if (schema && g_atomic_int_get (&schema->reserved) > 0)
|
||||||
|
secret_schema_unref ((SecretSchema *)schema);
|
||||||
|
}
|
||||||
|
|
||||||
G_DEFINE_BOXED_TYPE (SecretSchema, secret_schema, secret_schema_ref, secret_schema_unref);
|
G_DEFINE_BOXED_TYPE (SecretSchema, secret_schema, secret_schema_ref, secret_schema_unref);
|
||||||
|
Loading…
Reference in New Issue
Block a user