1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 5 Apr 2024 18:22:12 +0200
Subject: Free enchant dictionary resources
Fixes errors in tests
Origin: https://github.com/roundcube/roundcubemail/commit/a13f61cc7f5fa5c1572a7db36ce1c0ac2e801e2f
Forwarded: not-needed
---
program/lib/Roundcube/spellchecker/enchant.php | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/program/lib/Roundcube/spellchecker/enchant.php b/program/lib/Roundcube/spellchecker/enchant.php
index 1e59e68..4a5aad4 100644
--- a/program/lib/Roundcube/spellchecker/enchant.php
+++ b/program/lib/Roundcube/spellchecker/enchant.php
@@ -30,6 +30,17 @@ class rcube_spellchecker_enchant extends rcube_spellchecker_engine
private $enchant_dictionary;
private $matches = [];
+ /**
+ * Free object's resources
+ */
+ public function __destruct()
+ {
+ // If we don't do this we get "dictionaries weren't free'd" warnings in tests
+ if ($this->enchant_dictionary) {
+ $this->enchant_dictionary = null;
+ }
+ }
+
/**
* Return a list of languages supported by this backend
*
|