[gtranslator/fix-tm-memory-leak] Fix translation memory leak
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator/fix-tm-memory-leak] Fix translation memory leak
- Date: Wed, 9 Feb 2022 20:26:11 +0000 (UTC)
commit ac69be2f1126f0ae1ccf476f788f0d0d118d7bf7
Author: Daniel GarcĂa Moreno <dani danigm net>
Date: Wed Feb 9 21:20:55 2022 +0100
Fix translation memory leak
Fix https://gitlab.gnome.org/GNOME/gtranslator/-/issues/143
src/gtr-po.h | 2 ++
src/translation-memory/gtr-translation-memory-dialog.c | 4 +---
2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/gtr-po.h b/src/gtr-po.h
index c710508b..29809cdd 100644
--- a/src/gtr-po.h
+++ b/src/gtr-po.h
@@ -81,6 +81,8 @@ typedef enum
GTR_PO_STATE_MODIFIED
} GtrPoState;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtrPo, g_object_unref)
+
/*
* Public methods
*/
diff --git a/src/translation-memory/gtr-translation-memory-dialog.c
b/src/translation-memory/gtr-translation-memory-dialog.c
index 0e88e5d1..0c1846cb 100644
--- a/src/translation-memory/gtr-translation-memory-dialog.c
+++ b/src/translation-memory/gtr-translation-memory-dialog.c
@@ -124,7 +124,7 @@ add_to_database (gpointer data_pointer)
GList *msg_list = NULL;
GFile *location;
GError *error = NULL;
- GtrPo *po;
+ g_autoptr(GtrPo) po = NULL;
po = gtr_po_new ();
location = (GFile *) l->data;
@@ -136,8 +136,6 @@ add_to_database (gpointer data_pointer)
msg_list = gtr_po_get_messages (po);
gtr_translation_memory_store_list (data->tm, msg_list);
-
- g_object_unref (po);
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]