forked from qt-creator/qt-creator
QmlProfiler: Use QPointer for storing config widget
Most other options pages do it this way and none of them delete the widget in the destructor. Apparently we can rely on finish() getting called in time. Change-Id: Ie0964d291bc8ab3eea537921bf476012d58776a4 Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
QmlProfilerOptionsPage::QmlProfilerOptionsPage() : m_widget(0)
|
QmlProfilerOptionsPage::QmlProfilerOptionsPage()
|
||||||
{
|
{
|
||||||
setId(Constants::SETTINGS);
|
setId(Constants::SETTINGS);
|
||||||
setDisplayName(tr("QML Profiler"));
|
setDisplayName(tr("QML Profiler"));
|
||||||
@@ -45,11 +45,6 @@ QmlProfilerOptionsPage::QmlProfilerOptionsPage() : m_widget(0)
|
|||||||
setCategoryIcon(QLatin1String(":/images/analyzer_category.png"));
|
setCategoryIcon(QLatin1String(":/images/analyzer_category.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProfilerOptionsPage::~QmlProfilerOptionsPage()
|
|
||||||
{
|
|
||||||
delete m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *QmlProfilerOptionsPage::widget()
|
QWidget *QmlProfilerOptionsPage::widget()
|
||||||
{
|
{
|
||||||
// We cannot parent the widget to the options page as it expects a QWidget as parent
|
// We cannot parent the widget to the options page as it expects a QWidget as parent
|
||||||
@@ -66,7 +61,6 @@ void QmlProfilerOptionsPage::apply()
|
|||||||
void QmlProfilerOptionsPage::finish()
|
void QmlProfilerOptionsPage::finish()
|
||||||
{
|
{
|
||||||
delete m_widget;
|
delete m_widget;
|
||||||
m_widget = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#define QMLPROFILEROPTIONSPAGE_H
|
#define QMLPROFILEROPTIONSPAGE_H
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -40,14 +41,13 @@ class QmlProfilerOptionsPage : public Core::IOptionsPage
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QmlProfilerOptionsPage();
|
QmlProfilerOptionsPage();
|
||||||
~QmlProfilerOptionsPage();
|
|
||||||
|
|
||||||
QWidget *widget();
|
QWidget *widget();
|
||||||
void apply();
|
void apply();
|
||||||
void finish();
|
void finish();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *m_widget;
|
QPointer<QWidget> m_widget;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user