Cleanup: remove deleteLater() in QMLProfile

The actual profile object was destroyed with deleteLater() in the
destructor of QMLProfile. This is ominous, because the subobject
shouldn't survive the parent object.

Therefore, automatically destroy the profile by using a QScopedPointer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-05-25 23:30:10 +02:00 committed by Dirk Hohndel
parent d21d42b691
commit d7f5246d6b
2 changed files with 4 additions and 12 deletions

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "qmlprofile.h"
#include "qmlmanager.h"
#include "profile-widget/profilewidget2.h"
#include "core/subsurface-string.h"
#include "core/metrics.h"
#include <QTransform>
@ -10,10 +9,10 @@
QMLProfile::QMLProfile(QQuickItem *parent) :
QQuickPaintedItem(parent),
m_devicePixelRatio(1.0),
m_margin(0)
m_margin(0),
m_profileWidget(new ProfileWidget2)
{
setAntialiasing(true);
m_profileWidget = new ProfileWidget2(0);
m_profileWidget->setProfileState();
m_profileWidget->setPrintMode(true);
m_profileWidget->setFontPrintScale(0.8);
@ -21,11 +20,6 @@ QMLProfile::QMLProfile(QQuickItem *parent) :
setDevicePixelRatio(QMLManager::instance()->lastDevicePixelRatio());
}
QMLProfile::~QMLProfile()
{
m_profileWidget->deleteLater();
}
void QMLProfile::paint(QPainter *painter)
{
// let's look at the intended size of the content and scale our scene accordingly