Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mem-leak: delete menus & actions, unused Z origin label. #32

Merged
merged 1 commit into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/App/widgets/animationitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ AnimationItem::~AnimationItem()
}
delete frame;
}
delete m_contextMenu;
delete m_keyframes;
delete delAct;
delete bringToFrontAct;
Expand Down
11 changes: 8 additions & 3 deletions src/App/widgets/bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,16 @@ Bitmap::Bitmap(QImage image, AnimationScene *scene)
addMenu();
}

Bitmap::~Bitmap()
{
delete m_exchangeBitmapAct;
}

void Bitmap::addMenu()
{
QAction *exchangeBitmapAct = new QAction("Exchange Bitmap");
connect(exchangeBitmapAct, SIGNAL(triggered()), this, SLOT(exchangeBitmapAction()));
m_contextMenu->addAction(exchangeBitmapAct);
m_exchangeBitmapAct = new QAction("Exchange Bitmap");
connect(m_exchangeBitmapAct, SIGNAL(triggered()), this, SLOT(exchangeBitmapAction()));
m_contextMenu->addAction(m_exchangeBitmapAct);
}

void Bitmap::exchangeBitmapAction()
Expand Down
3 changes: 3 additions & 0 deletions src/App/widgets/bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#ifndef BITMAP_H
#define BITMAP_H

#include <QAction>
#include <QDomElement>
#include <QImage>
#include <QObject>
Expand All @@ -38,6 +39,7 @@ class Bitmap : public AnimationItem
Bitmap();
Bitmap(QString filename, AnimationScene *scene);
Bitmap(QImage img, AnimationScene *scene);
~Bitmap();

void paint( QPainter *paint, const QStyleOptionGraphicsItem *, QWidget *);
QString getHtml(QString id, QString assetsPath) Q_DECL_OVERRIDE;
Expand All @@ -55,6 +57,7 @@ private slots:

private:
QImage m_image;
QAction *m_exchangeBitmapAct;

void addMenu();
};
Expand Down
2 changes: 0 additions & 2 deletions src/App/widgets/itempropertyeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,12 @@ ItemPropertyEditor::ItemPropertyEditor(Timeline *timeline)
QLabel *labelOrig = new QLabel("Origin");
QLabel *labelOrigX = new QLabel("X");
QLabel *labelOrigY = new QLabel("Y");
QLabel *labelOrigZ = new QLabel("Z");
labelScaleX->setFixedWidth(15);
labelScaleY->setFixedWidth(15);
labelShearX->setFixedWidth(15);
labelShearY->setFixedWidth(15);
labelOrigX->setFixedWidth(15);
labelOrigY->setFixedWidth(15);
labelOrigZ->setFixedWidth(15);
m_scaleX = new QSpinBox();
m_scaleX->setMinimum(-10000);
m_scaleX->setMaximum(10000);
Expand Down
6 changes: 6 additions & 0 deletions src/App/widgets/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ Text::Text(QString text, AnimationScene *scene)
setRect(0, 0, m_svg->boundingRect().width(), m_svg->boundingRect().height());
}

Text::~Text()
{
delete m_renderer;
delete m_svg;
}

int Text::type() const
{
return Text::Type;
Expand Down
1 change: 1 addition & 0 deletions src/App/widgets/text.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class Text : public AnimationItem

public:
Text(QString text, AnimationScene *scene);
~Text();

void paint( QPainter *paint, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE;
void scaleObjects() Q_DECL_OVERRIDE;
Expand Down
1 change: 1 addition & 0 deletions src/App/widgets/timeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Timeline::Timeline(AnimationScene *scene)

Timeline::~Timeline()
{
delete m_contextMenu;
delete m_delAct;
delete m_forwardAct;
delete m_pauseAct;
Expand Down