File: Free-enchant-dictionary-resources.patch

package info (click to toggle)
roundcube 1.6.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 44,868 kB
  • sloc: javascript: 195,588; php: 76,818; sql: 3,150; sh: 2,882; pascal: 1,079; makefile: 234; xml: 93; perl: 73; ansic: 48; python: 21
file content (34 lines) | stat: -rw-r--r-- 1,130 bytes parent folder | download
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
      *