[poppler] glib/demo glib/poppler-document.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 30 11:57:05 UTC 2023
glib/demo/signature.c | 9 ++++++---
glib/poppler-document.cc | 3 ++-
2 files changed, 8 insertions(+), 4 deletions(-)
New commits:
commit fac65b3c791b6a1bb3fa83d122b9fce9a6a93ee7
Author: Jan-Michael Brummer <jan.brummer at tabos.org>
Date: Fri Jun 30 11:50:29 2023 +0200
Remove g_auto functions
diff --git a/glib/demo/signature.c b/glib/demo/signature.c
index 15c68c5a..c73ca849 100644
--- a/glib/demo/signature.c
+++ b/glib/demo/signature.c
@@ -267,12 +267,13 @@ static gboolean pgd_signature_drawing_area_motion_notify(GtkWidget *area, GdkEve
static void on_signing_done(GObject *source, GAsyncResult *result, gpointer user_data)
{
PopplerDocument *document = POPPLER_DOCUMENT(source);
- g_autoptr(GError) error = NULL;
+ GError *error = NULL;
gboolean ret = poppler_document_sign_finish(document, result, &error);
g_print("%s: result %d\n", __FUNCTION__, ret);
if (error) {
g_print("Error: %s", error->message);
+ g_error_free(error);
}
}
@@ -290,8 +291,8 @@ static gboolean pgd_signature_drawing_area_button_release(GtkWidget *area, GdkEv
GList *available_certificates = poppler_get_available_signing_certificates();
if (available_certificates) {
- g_autofree char *signature = NULL;
- g_autofree char *signature_left = NULL;
+ char *signature;
+ char *signature_left;
PopplerSigningData *data = poppler_signing_data_new();
PopplerRectangle rect;
PopplerCertificateInfo *certificate_info;
@@ -328,9 +329,11 @@ static gboolean pgd_signature_drawing_area_button_release(GtkWidget *area, GdkEv
signature = g_strdup_printf("Digitally signed by %s\nDate: %s", poppler_certificate_info_get_subject_common_name(certificate_info), ctime(&t));
poppler_signing_data_set_signature_text(data, signature);
+ g_free(signature);
signature_left = g_strdup_printf("%s", poppler_certificate_info_get_subject_common_name(certificate_info));
poppler_signing_data_set_signature_text_left(data, signature_left);
+ g_free(signature_left);
poppler_document_sign(demo->doc, data, NULL, on_signing_done, NULL);
}
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 4092e51d..fca3ce9f 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -3883,7 +3883,7 @@ static void _poppler_sign_document_thread(GTask *task, PopplerDocument *document
**/
void poppler_document_sign(PopplerDocument *document, const PopplerSigningData *signing_data, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{
- g_autoptr(GTask) task = nullptr;
+ GTask *task;
g_return_if_fail(POPPLER_IS_DOCUMENT(document));
g_return_if_fail(signing_data != nullptr);
@@ -3892,6 +3892,7 @@ void poppler_document_sign(PopplerDocument *document, const PopplerSigningData *
g_task_set_task_data(task, (void *)signing_data, nullptr);
g_task_run_in_thread(task, (GTaskThreadFunc)_poppler_sign_document_thread);
+ g_object_unref(task);
}
/**
More information about the poppler
mailing list