From ed28fa5238ec4ee01add911c71874128309fc182 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Thu, 8 Aug 2024 16:06:33 +0100 Subject: [PATCH] AppleSpell provider: update to use correct destructor methods Add missing enchant_provider_free to enchant-provider.h --- lib/enchant-provider.h | 8 ++++++++ providers/applespell_checker.mm | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/enchant-provider.h b/lib/enchant-provider.h index 153f86c5..4d524d0b 100644 --- a/lib/enchant-provider.h +++ b/lib/enchant-provider.h @@ -136,6 +136,14 @@ void enchant_dict_set_error (EnchantDict * dict, const char * const err); */ EnchantProvider *enchant_provider_new (void); +/** + * enchant_provider_free + * + * Frees an EnchantProvider. + */ +void enchant_provider_unref (EnchantProvider * provider); +#define enchant_provider_free enchant_provider_unref + /** * enchant_provider_set_error * @provider: A non-null provider diff --git a/providers/applespell_checker.mm b/providers/applespell_checker.mm index 2798a53c..d9c8c137 100644 --- a/providers/applespell_checker.mm +++ b/providers/applespell_checker.mm @@ -314,7 +314,7 @@ static int appleSpell_dict_check (EnchantDict * me, const char * const word, siz AppleSpellDictionary * ASD = g_new0 (AppleSpellDictionary, 1); if (!ASD) { - g_free (dict); + enchant_broker_free_dict (me->owner, dict); return 0; } @@ -324,7 +324,7 @@ static int appleSpell_dict_check (EnchantDict * me, const char * const word, siz if (!ASD->DictionaryName) { g_free (ASD); - g_free (dict); + enchant_broker_free_dict (me->owner, dict); return 0; } @@ -443,7 +443,7 @@ static void appleSpell_provider_dispose (EnchantProvider * me) } else { - g_free (provider); + enchant_provider_free (provider); provider = 0; }