summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate
authorerik <erik>2007-01-19 01:12:38 (UTC)
committer erik <erik>2007-01-19 01:12:38 (UTC)
commit1ab92f1d2b346de7da8ca5c3aaa6bc75b43981e7 (patch) (side-by-side diff)
treeaf4a12bc46e25853386dc53868b869e1bf05d863 /noncore/apps/tinykate
parent2b45dc71e79a3eb7d4e8553273c9bc4f4282d50a (diff)
downloadopie-1ab92f1d2b346de7da8ca5c3aaa6bc75b43981e7.zip
opie-1ab92f1d2b346de7da8ca5c3aaa6bc75b43981e7.tar.gz
opie-1ab92f1d2b346de7da8ca5c3aaa6bc75b43981e7.tar.bz2
Every single file in this commit had a memory leak where a resource is
allocated in the constructor but not de-allocated in the destructor. This commit fixes that.
Diffstat (limited to 'noncore/apps/tinykate') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/document/katehighlight.cpp7
-rw-r--r--noncore/apps/tinykate/libkate/document/katehighlight.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.cpp b/noncore/apps/tinykate/libkate/document/katehighlight.cpp
index 539d356..89024f7 100644
--- a/noncore/apps/tinykate/libkate/document/katehighlight.cpp
+++ b/noncore/apps/tinykate/libkate/document/katehighlight.cpp
@@ -389,13 +389,18 @@ const QChar *HlAnyChar::checkHgl(const QChar *s, int len, bool)
}
HlRegExpr::HlRegExpr(int attribute, int context,QString regexp)
- : HlItem(attribute, context) {
+ : HlItem(attribute, context), Expr(0) {
handlesLinestart=regexp.startsWith("^");
if(!handlesLinestart) regexp.prepend("^");
Expr=new QRegExp3(regexp);
}
+HlRegExpr::~HlRegExpr()
+{
+ delete Expr;
+}
+
const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart)
{
if ((!lineStart) && handlesLinestart) return 0;
diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.h b/noncore/apps/tinykate/libkate/document/katehighlight.h
index fddf585..f0be27b 100644
--- a/noncore/apps/tinykate/libkate/document/katehighlight.h
+++ b/noncore/apps/tinykate/libkate/document/katehighlight.h
@@ -184,7 +184,7 @@ class HlAnyChar : public HlItem {
class HlRegExpr : public HlItem {
public:
HlRegExpr(int attribute, int context,QString expr);
- ~HlRegExpr(){delete Expr;};
+ ~HlRegExpr();
virtual const QChar *checkHgl(const QChar *, int len, bool);
QRegExp3 *Expr;
bool handlesLinestart;