From ffdddbb4ec2cd839c0303f3214de9a202a135ef1 Mon Sep 17 00:00:00 2001 From: Paolo Stivanin Date: Wed, 9 Mar 2022 13:36:43 +0100 Subject: [PATCH] Update to release 1.0.2 --- CMakeLists.txt | 2 +- ...github.paolostivanin.GTKCrypto.appdata.xml | 12 ++++++++++ src/cleanup.c | 13 +++++++---- src/decrypt-file.c | 2 +- src/decrypt-files-cb.c | 3 +-- src/gpgme-misc.c | 9 +++----- src/gtkcrypto.h | 2 +- src/main.h | 2 +- src/verify-signature-cb.c | 23 +++++++++++-------- 9 files changed, 43 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index df2ebbd..fb3a75a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) set(GTKCRYPTO_VERSION_MAJOR "1") set(GTKCRYPTO_VERSION_MINOR "0") -set(GTKCRYPTO_VERSION_PATCH "1") +set(GTKCRYPTO_VERSION_PATCH "2") set(GTKCRYPTO_VERSION "${GTKCRYPTO_VERSION_MAJOR}.${GTKCRYPTO_VERSION_MINOR}.${GTKCRYPTO_VERSION_PATCH}") set(CMAKE_C_STANDARD 11) diff --git a/data/com.github.paolostivanin.GTKCrypto.appdata.xml b/data/com.github.paolostivanin.GTKCrypto.appdata.xml index 3adf804..6eabefc 100644 --- a/data/com.github.paolostivanin.GTKCrypto.appdata.xml +++ b/data/com.github.paolostivanin.GTKCrypto.appdata.xml @@ -63,6 +63,18 @@ Supported hash algorithms: MD5, SHA-1, SHA-2, SHA-3, GOST, Whirlpool. + + +

GTKCrypto 1.0.2 brings some fixes

+
    +
  • fix double free when decrypting a file
  • +
  • fix incorrect version set on header bar
  • +
  • fix UI bug when listing GPG keys
  • +
  • fix signature verification workflow
  • +
  • fix UI file path
  • +
+
+

GTKCrypto 1.0.1 brings some small fixes

diff --git a/src/cleanup.c b/src/cleanup.c index e9be657..fe4e222 100644 --- a/src/cleanup.c +++ b/src/cleanup.c @@ -21,14 +21,19 @@ gfile_cleanup (GFile *ifile, g_object_unref(ofile); } + void gstream_cleanup (GFileInputStream *istream, GFileOutputStream *ostream) { - g_input_stream_close (G_INPUT_STREAM (istream), NULL, NULL); - g_output_stream_close (G_OUTPUT_STREAM (ostream), NULL, NULL); - g_object_unref (istream); - g_object_unref (ostream); + if (istream != NULL) { + g_input_stream_close (G_INPUT_STREAM (istream), NULL, NULL); + g_object_unref (istream); + } + if (ostream != NULL) { + g_output_stream_close (G_OUTPUT_STREAM (ostream), NULL, NULL); + g_object_unref (ostream); + } } diff --git a/src/decrypt-file.c b/src/decrypt-file.c index e3bf287..25e8c58 100644 --- a/src/decrypt-file.c +++ b/src/decrypt-file.c @@ -197,7 +197,7 @@ get_g_file_with_encrypted_data (GFileInputStream *in_stream, } } - gstream_cleanup (in_stream, out_enc_stream); + gstream_cleanup (NULL, out_enc_stream); g_free (buf); return tmp_encrypted_file; diff --git a/src/decrypt-files-cb.c b/src/decrypt-files-cb.c index e558de3..7a2d5ed 100644 --- a/src/decrypt-files-cb.c +++ b/src/decrypt-files-cb.c @@ -98,7 +98,7 @@ prepare_multi_decryption_cb (GtkWidget *widget __attribute__((unused)), g_mutex_init (&thread_data->mutex); - data->thread_pool = g_thread_pool_new (exec_thread, thread_data, g_get_num_processors (), TRUE, NULL); + data->thread_pool = g_thread_pool_new (exec_thread, thread_data, (gint)g_get_num_processors (), TRUE, NULL); for (guint i = 0; i < thread_data->list_len; i++) { g_thread_pool_push (data->thread_pool, g_slist_nth_data (data->files_list, i), NULL); } @@ -126,7 +126,6 @@ exec_thread (gpointer data, if (thread_data->delete_file && ret == NULL) { g_unlink (filename); } - g_mutex_lock (&thread_data->mutex); thread_data->widgets->running_threads--; thread_data->widgets->first_run = FALSE; diff --git a/src/gpgme-misc.c b/src/gpgme-misc.c index 4a198bf..937fa43 100644 --- a/src/gpgme-misc.c +++ b/src/gpgme-misc.c @@ -169,12 +169,13 @@ get_available_keys () GSList *list = NULL; KeyInfo *key_info; - key_info = g_new0 (KeyInfo, 1); while (1) { err = gpgme_op_keylist_next (ctx, &key); if (err) { break; } + + key_info = g_new0 (KeyInfo, 1); key_info->key_id = g_strdup (key->subkeys->keyid); if (key->uids && key->uids->name) { key_info->name = g_strdup (key->uids->name); @@ -193,15 +194,11 @@ get_available_keys () list = g_slist_append (list, g_memdupX (key_info, (guint)bytes_to_copy)); - g_free (key_info->key_id); - g_free (key_info->name); - g_free (key_info->email); - g_free (key_info->key_fpr); + g_free (key_info); gpgme_key_release (key); } - g_free (key_info); gpgme_release (ctx); return list; diff --git a/src/gtkcrypto.h b/src/gtkcrypto.h index ba2c02b..4cb4e60 100644 --- a/src/gtkcrypto.h +++ b/src/gtkcrypto.h @@ -1,6 +1,6 @@ #pragma once -#define PARTIAL_PATH_TO_UI_FILE "share/gtkcrypto/widgets.ui" +#define PARTIAL_PATH_TO_UI_FILE "share/gtkcrypto/gtkcrypto.ui" void show_message_dialog (GtkWidget *parent, const gchar *message, GtkMessageType); diff --git a/src/main.h b/src/main.h index 7fc444a..8188b70 100644 --- a/src/main.h +++ b/src/main.h @@ -1,7 +1,7 @@ #pragma once #define APP_NAME "GTKCrypto" -#define APP_VERSION "1.0.0" +#define APP_VERSION "1.0.2" #define GCRYPT_MIN_VERSION "1.7.0" #define SECURE_MEMORY_POOL_SIZE 32768 diff --git a/src/verify-signature-cb.c b/src/verify-signature-cb.c index 0f5be2c..6a289cf 100644 --- a/src/verify-signature-cb.c +++ b/src/verify-signature-cb.c @@ -66,16 +66,16 @@ verify_signature_cb (GtkWidget *btn __attribute__((unused)), verify_widgets->signed_file_entry = gtk_entry_new (); gtk_widget_set_name (GTK_WIDGET (verify_widgets->signed_file_entry), "signed_file_entry"); gtk_entry_set_placeholder_text (GTK_ENTRY (verify_widgets->signed_file_entry), "Choose signed file"); - verify_widgets->signature_file_entry = gtk_entry_new (); - gtk_widget_set_name (GTK_WIDGET (verify_widgets->signed_file_entry), "signature_file_entry"); - gtk_entry_set_placeholder_text (GTK_ENTRY (verify_widgets->signature_file_entry), "Choose signature (.sig) file"); gtk_editable_set_editable (GTK_EDITABLE (verify_widgets->signed_file_entry), FALSE); - gtk_editable_set_editable (GTK_EDITABLE (verify_widgets->signature_file_entry), FALSE); gtk_widget_set_hexpand (verify_widgets->signed_file_entry, TRUE); - gtk_widget_set_hexpand (verify_widgets->signature_file_entry, TRUE); - gtk_entry_set_icon_from_icon_name (GTK_ENTRY (verify_widgets->signed_file_entry), GTK_ENTRY_ICON_SECONDARY, "document-open-symbolic"); + + verify_widgets->signature_file_entry = gtk_entry_new (); + gtk_widget_set_name (GTK_WIDGET (verify_widgets->signature_file_entry), "signature_file_entry"); + gtk_entry_set_placeholder_text (GTK_ENTRY (verify_widgets->signature_file_entry), "Choose signature (.sig) file"); + gtk_editable_set_editable (GTK_EDITABLE (verify_widgets->signature_file_entry), FALSE); + gtk_widget_set_hexpand (verify_widgets->signature_file_entry, TRUE); gtk_entry_set_icon_from_icon_name (GTK_ENTRY (verify_widgets->signature_file_entry), GTK_ENTRY_ICON_SECONDARY, "document-open-symbolic"); @@ -158,7 +158,9 @@ select_file_cb (GtkEntry *entry, verify_widgets->entry_data.entry1_filename = g_strdup (filename); } else { verify_widgets->entry_data.entry2_filename = g_strdup (filename); + } + gtk_entry_set_text (entry, filename); g_free (filename); } @@ -191,9 +193,12 @@ entry_changed_cb (GtkWidget *btn, gtk_widget_show (thread_data->spinner); start_spinner (thread_data->spinner); - change_widgets_sensitivity (3, FALSE, &verify_widgets->cancel_btn, - verify_widgets->signed_file_entry, - verify_widgets->signature_file_entry); + if (gtk_widget_get_sensitive (verify_widgets->signed_file_entry) != FALSE) { + gtk_widget_set_sensitive (verify_widgets->signed_file_entry, FALSE); + } + if (gtk_widget_get_sensitive (verify_widgets->signature_file_entry) != FALSE) { + gtk_widget_set_sensitive (verify_widgets->signature_file_entry, FALSE); + } verify_widgets->thread = g_thread_new (NULL, exec_thread, thread_data); }