blob: 9f734800753fdaf9c14835335605a978c6b0ace0 (
plain) (
blame)
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
35
36
|
From 9657fd3ad95536c19c8b3f68987614d81b04845c Mon Sep 17 00:00:00 2001
From: Martin Hostettler <textshell@uchuujin.de>
Date: Sun, 6 Sep 2026 13:42:25 +0200
Subject: [PATCH] tests: readWrite: Fix memory leak.
Additionally when the File instance is kept alive, it might later
reference the text metrics now internally bound to a now destructed
terminal in a later event loop iteration.
---
src/tests/tests.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp
index 2b170c8..efb2107 100644
--- a/src/tests/tests.cpp
+++ b/src/tests/tests.cpp
@@ -39,11 +39,11 @@ void readWrite(QString in) {
Tui::ZTerminal terminal(of);
QString out = in + "_dub";
- File *f = new File(terminal.textMetrics(), nullptr);
- //f->setFilename(in);
- CHECK(f->openText(in));
- f->setFilename(out);
- CHECK(f->saveText());
+ File f(terminal.textMetrics(), nullptr);
+ //f.setFilename(in);
+ CHECK(f.openText(in));
+ f.setFilename(out);
+ CHECK(f.saveText());
CHECK(fileChecksum(in) == fileChecksum(out));
--
2.55.0
|