Commit eb548b00 authored by Albert Astals Cid's avatar Albert Astals Cid Committed by Simone Gaiarin
Browse files

Fix 3 small memory leaks

parent 681f4053
Pipeline #38985 passed with stage
in 12 minutes and 51 seconds
......@@ -43,8 +43,6 @@ public:
explicit AnnotationActionHandlerPrivate(AnnotationActionHandler *qq)
: q(qq)
, annotator(nullptr)
, textTools(nullptr)
, textQuickTools(nullptr)
, agTools(nullptr)
, agLastAction(nullptr)
, aQuickTools(nullptr)
......@@ -103,8 +101,8 @@ public:
PageViewAnnotator *annotator;
QList<QAction *> *textTools;
QList<QAction *> *textQuickTools;
QList<QAction *> textTools;
QList<QAction *> textQuickTools;
QActionGroup *agTools;
QAction *agLastAction;
......@@ -341,7 +339,7 @@ void AnnotationActionHandlerPrivate::populateQuickAnnotations()
const QList<int> numberKeys = {Qt::Key_1, Qt::Key_2, Qt::Key_3, Qt::Key_4, Qt::Key_5, Qt::Key_6, Qt::Key_7, Qt::Key_8, Qt::Key_9, Qt::Key_0};
textQuickTools->clear();
textQuickTools.clear();
aQuickTools->removeAllActions();
int favToolId = 1;
......@@ -361,7 +359,7 @@ void AnnotationActionHandlerPrivate::populateQuickAnnotations()
QDomElement engineElement = favToolElement.firstChildElement(QStringLiteral("engine"));
if (engineElement.attribute(QStringLiteral("type")) == QStringLiteral("TextSelector")) {
textQuickTools->append(annFav);
textQuickTools.append(annFav);
annFav->setEnabled(textToolsEnabled);
}
......@@ -559,12 +557,10 @@ AnnotationActionHandler::AnnotationActionHandler(PageViewAnnotator *parent, KAct
d->agTools->addAction(aEllipse);
d->agTools->addAction(aPolygon);
d->textQuickTools = new QList<QAction *>();
d->textTools = new QList<QAction *>();
d->textTools->append(aHighlighter);
d->textTools->append(aUnderline);
d->textTools->append(aSquiggle);
d->textTools->append(aStrikeout);
d->textTools.append(aHighlighter);
d->textTools.append(aUnderline);
d->textTools.append(aSquiggle);
d->textTools.append(aStrikeout);
int toolId = 1;
const QList<QAction *> tools = d->agTools->actions();
......@@ -751,10 +747,10 @@ void AnnotationActionHandler::setToolsEnabled(bool on)
void AnnotationActionHandler::setTextToolsEnabled(bool on)
{
d->textToolsEnabled = on;
for (QAction *ann : qAsConst(*d->textTools)) {
for (QAction *ann : qAsConst(d->textTools)) {
ann->setEnabled(on);
}
for (QAction *ann : qAsConst(*d->textQuickTools)) {
for (QAction *ann : qAsConst(d->textQuickTools)) {
ann->setEnabled(on);
}
}
......
......@@ -772,6 +772,8 @@ void PageViewAnnotator::reparseQuickToolsConfig()
PageViewAnnotator::~PageViewAnnotator()
{
delete m_engine;
delete m_builtinToolsDefinition;
delete m_quickToolsDefinition;
}
bool PageViewAnnotator::active() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment