Commit aef4280b authored by Christian Kandeler's avatar Christian Kandeler

Do not use QWeakPointer to track QObjects.

This use case is deprecated in Qt 5. Use QPointer instead.

Change-Id: Id6c32542032656d7cb31cf838d93a680ab9e9327
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent f21a408b
......@@ -244,7 +244,7 @@ ContextPaneWidget::~ContextPaneWidget()
//if the pane was never activated the widget is not in a widget tree
if (!m_bauhausColorDialog.isNull())
delete m_bauhausColorDialog.data();
m_bauhausColorDialog.clear();
m_bauhausColorDialog = 0;
}
void ContextPaneWidget::activate(const QPoint &pos, const QPoint &alternative, const QPoint &alternative2, bool pinned)
......
......@@ -33,7 +33,7 @@
#include <qmleditorwidgets_global.h>
#include <QFrame>
#include <QWeakPointer>
#include <QPointer>
QT_BEGIN_NAMESPACE
class QToolButton;
......@@ -76,7 +76,7 @@ private:
QGraphicsDropShadowEffect *m_dropShadowEffect;
QGraphicsOpacityEffect *m_opacityEffect;
QPoint m_startPos;
QWeakPointer<QWidget> m_secondaryTarget;
QPointer<QWidget> m_secondaryTarget;
};
class QMLEDITORWIDGETS_EXPORT ContextPaneWidget : public DragWidget
......@@ -138,9 +138,9 @@ private:
ContextPaneWidgetImage *m_imageWidget;
ContextPaneWidgetImage *m_borderImageWidget;
ContextPaneWidgetRectangle *m_rectangleWidget;
QWeakPointer<CustomColorDialog> m_bauhausColorDialog;
QWeakPointer<QAction> m_resetAction;
QWeakPointer<QAction> m_disableAction;
QPointer<CustomColorDialog> m_bauhausColorDialog;
QPointer<QAction> m_resetAction;
QPointer<QAction> m_disableAction;
QString m_colorName;
QPoint m_originalPos;
bool m_pinned;
......
......@@ -32,10 +32,12 @@
#define CONTEXTPANEWIDGETIMAGE_H
#include <qmleditorwidgets_global.h>
#include <QLabel>
#include <contextpanewidget.h>
#include <qdrawutil.h>
#include <QLabel>
#include <QPointer>
QT_BEGIN_NAMESPACE
namespace Ui {
class ContextPaneWidgetImage;
......@@ -157,7 +159,7 @@ private:
Ui::ContextPaneWidgetImage *ui;
Ui::ContextPaneWidgetBorderImage *uiBorderImage;
QString m_path;
QWeakPointer<PreviewDialog> m_previewDialog;
QPointer<PreviewDialog> m_previewDialog;
FileWidget *m_fileWidget;
QLabel *m_sizeLabel;
bool m_borderImage;
......
......@@ -90,6 +90,7 @@
#include <QLabel>
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QPointer>
#include <QPushButton>
using namespace Core;
......@@ -213,7 +214,7 @@ public:
MainWindowSettingsMap m_defaultSettings;
// list of dock widgets to prevent memory leak
typedef QWeakPointer<QDockWidget> DockPtr;
typedef QPointer<QDockWidget> DockPtr;
QList<DockPtr> m_dockWidgets;
};
......
......@@ -45,6 +45,7 @@
#include <QPair>
#include <QFileInfo>
#include <QPointer>
#include <QStringList>
#include <QDebug>
......@@ -101,7 +102,7 @@ public:
public:
Internal::DesignModeCoreListener *m_coreListener;
QWeakPointer<Core::IEditor> m_currentEditor;
QPointer<Core::IEditor> m_currentEditor;
bool m_isActive;
bool m_isRequired;
QList<DesignEditorInfo*> m_editors;
......@@ -237,10 +238,10 @@ void DesignMode::currentEditorChanged(Core::IEditor *editor)
if (ModeManager::currentMode() == this)
ModeManager::activateMode(Core::Constants::MODE_EDIT);
setEnabled(false);
d->m_currentEditor = QWeakPointer<Core::IEditor>();
d->m_currentEditor = 0;
emit actionsUpdated(d->m_currentEditor.data());
} else {
d->m_currentEditor = QWeakPointer<Core::IEditor>(editor);
d->m_currentEditor = editor;
if (d->m_currentEditor)
connect(d->m_currentEditor.data(), SIGNAL(changed()), this, SLOT(updateActions()));
......
......@@ -42,6 +42,7 @@
#include <QLayout>
#include <QToolBar>
#include <QAction>
#include <QPointer>
#include <QToolButton>
namespace Core {
......@@ -80,7 +81,7 @@ struct SideBarPrivate {
SideBarPrivate() :m_closeWhenEmpty(false) {}
QList<Internal::SideBarWidget*> m_widgets;
QMap<QString, QWeakPointer<SideBarItem> > m_itemMap;
QMap<QString, QPointer<SideBarItem> > m_itemMap;
QStringList m_availableItemIds;
QStringList m_availableItemTitles;
QStringList m_unavailableItemIds;
......@@ -109,7 +110,7 @@ SideBar::SideBar(QList<SideBarItem*> itemList,
SideBar::~SideBar()
{
foreach (const QWeakPointer<SideBarItem> &i, d->m_itemMap)
foreach (const QPointer<SideBarItem> &i, d->m_itemMap)
if (!i.isNull())
delete i.data();
delete d;
......@@ -117,7 +118,7 @@ SideBar::~SideBar()
QString SideBar::idForTitle(const QString &title) const
{
QMapIterator<QString, QWeakPointer<SideBarItem> > iter(d->m_itemMap);
QMapIterator<QString, QPointer<SideBarItem> > iter(d->m_itemMap);
while(iter.hasNext()) {
iter.next();
if (iter.value().data()->title() == title)
......@@ -152,7 +153,7 @@ void SideBar::setCloseWhenEmpty(bool value)
void SideBar::makeItemAvailable(SideBarItem *item)
{
typedef QMap<QString, QWeakPointer<SideBarItem> >::const_iterator Iterator;
typedef QMap<QString, QPointer<SideBarItem> >::const_iterator Iterator;
const Iterator cend = d->m_itemMap.constEnd();
for (Iterator it = d->m_itemMap.constBegin(); it != cend ; ++it) {
......@@ -266,7 +267,7 @@ void SideBar::saveSettings(QSettings *settings, const QString &name)
views.append(currentItemId);
}
if (views.isEmpty() && d->m_itemMap.size()) {
QMapIterator<QString, QWeakPointer<SideBarItem> > iter(d->m_itemMap);
QMapIterator<QString, QPointer<SideBarItem> > iter(d->m_itemMap);
iter.next();
views.append(iter.key());
}
......@@ -322,7 +323,7 @@ void SideBar::readSettings(QSettings *settings, const QString &name)
void SideBar::activateItem(SideBarItem *item)
{
typedef QMap<QString, QWeakPointer<SideBarItem> >::const_iterator Iterator;
typedef QMap<QString, QPointer<SideBarItem> >::const_iterator Iterator;
QString id;
const Iterator cend = d->m_itemMap.constEnd();
......
......@@ -107,7 +107,7 @@ public:
ProjectInfo()
{ }
ProjectInfo(QWeakPointer<ProjectExplorer::Project> project)
ProjectInfo(QPointer<ProjectExplorer::Project> project)
: m_project(project)
{ }
......@@ -120,7 +120,7 @@ public:
bool isNull() const
{ return m_project.isNull(); }
QWeakPointer<ProjectExplorer::Project> project() const
QPointer<ProjectExplorer::Project> project() const
{ return m_project; }
const QList<ProjectPart::Ptr> projectParts() const
......@@ -142,7 +142,7 @@ public:
{ return m_defines; }
private: // attributes
QWeakPointer<ProjectExplorer::Project> m_project;
QPointer<ProjectExplorer::Project> m_project;
QList<ProjectPart::Ptr> m_projectParts;
// the attributes below are calculated from the project parts.
QStringList m_includePaths;
......
......@@ -71,6 +71,7 @@
#include <QErrorMessage>
#include <QFormLayout>
#include <QLabel>
#include <QPointer>
using namespace Debugger::Internal;
using namespace ProjectExplorer;
......@@ -262,7 +263,7 @@ public:
public:
DebuggerRunControl *q;
DebuggerEngine *m_engine;
const QWeakPointer<RunConfiguration> m_myRunConfiguration;
const QPointer<RunConfiguration> m_myRunConfiguration;
bool m_running;
};
......
......@@ -35,7 +35,7 @@
#include <QWidget>
#include <QSharedPointer>
#include <QWeakPointer>
#include <QPointer>
QT_BEGIN_NAMESPACE
class QLineEdit;
......@@ -85,7 +85,7 @@ public:
private:
const QSharedPointer<GerritParameters> &m_parameters;
QWeakPointer<GerritOptionsWidget> m_widget;
QPointer<GerritOptionsWidget> m_widget;
};
} // namespace Internal
......
......@@ -32,8 +32,8 @@
#define GERRIT_INTERNAL_GERRITPLUGIN_H
#include <QObject>
#include <QPointer>
#include <QSharedPointer>
#include <QWeakPointer>
namespace Core {
class ActionContainer;
......@@ -71,7 +71,7 @@ private:
void fetch(const QSharedPointer<Gerrit::Internal::GerritChange> &change, int mode);
QSharedPointer<GerritParameters> m_parameters;
QWeakPointer<GerritDialog> m_dialog;
QPointer<GerritDialog> m_dialog;
};
} // namespace Internal
......
......@@ -46,8 +46,8 @@
#include <QDir>
#include <QFileInfo>
#include <QLatin1Char>
#include <QPointer>
#include <QProcess>
#include <QWeakPointer>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
......@@ -111,7 +111,7 @@ class MaemoCopyFilesToSysrootWidget : public BuildStepConfigWidget
{
Q_OBJECT
public:
MaemoCopyFilesToSysrootWidget(const BuildStep *buildStep)
MaemoCopyFilesToSysrootWidget(BuildStep *buildStep)
: m_buildStep(buildStep)
{
if (m_buildStep) {
......@@ -126,7 +126,7 @@ public:
}
virtual bool showWidget() const { return false; }
private:
const QWeakPointer<const BuildStep> m_buildStep;
const QPointer<BuildStep> m_buildStep;
};
......
......@@ -49,6 +49,7 @@
#include <utils/qtcassert.h>
#include <QDir>
#include <QPointer>
#include <QTime>
#include <QTimer>
#include <QMetaType>
......@@ -98,7 +99,7 @@ struct BuildManagerPrivate {
int m_maxProgress;
QFutureInterface<void> *m_progressFutureInterface;
QFutureWatcher<void> m_progressWatcher;
QWeakPointer<Core::FutureProgress> m_futureProgress;
QPointer<Core::FutureProgress> m_futureProgress;
};
BuildManagerPrivate::BuildManagerPrivate() :
......@@ -275,7 +276,7 @@ void BuildManager::clearBuildQueue()
d->m_progressWatcher.setFuture(QFuture<void>());
delete d->m_progressFutureInterface;
d->m_progressFutureInterface = 0;
d->m_futureProgress.clear();
d->m_futureProgress = 0;
d->m_maxProgress = 0;
emit buildQueueFinished(false);
......@@ -322,10 +323,10 @@ void BuildManager::startBuildQueue(const QStringList &preambleMessage)
d->m_taskHub->clearTasks(Core::Id(Constants::TASK_CATEGORY_COMPILE));
d->m_taskHub->clearTasks(Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
progressManager->setApplicationLabel(QString());
d->m_futureProgress = QWeakPointer<Core::FutureProgress>(progressManager->addTask(d->m_progressFutureInterface->future(),
d->m_futureProgress = progressManager->addTask(d->m_progressFutureInterface->future(),
QString(),
QLatin1String(Constants::TASK_BUILD),
Core::ProgressManager::KeepOnFinish | Core::ProgressManager::ShowInApplicationIcon));
Core::ProgressManager::KeepOnFinish | Core::ProgressManager::ShowInApplicationIcon);
connect(d->m_futureProgress.data(), SIGNAL(clicked()), this, SLOT(showBuildResults()));
d->m_futureProgress.data()->setWidget(new Internal::BuildProgress(d->m_taskWindow));
d->m_progress = 0;
......
......@@ -38,7 +38,7 @@
#include <utils/outputformat.h>
#include <QMetaType>
#include <QWeakPointer>
#include <QPointer>
#include <QWidget>
QT_FORWARD_DECLARE_CLASS(QIcon)
......@@ -305,7 +305,7 @@ protected:
private:
QString m_displayName;
RunMode m_runMode;
const QWeakPointer<RunConfiguration> m_runConfiguration;
const QPointer<RunConfiguration> m_runConfiguration;
Utils::OutputFormatter *m_outputFormatter;
// A handle to the actual application process.
......
......@@ -123,7 +123,7 @@ QuickToolBar::~QuickToolBar()
//if the pane was never activated the widget is not in a widget tree
if (!m_widget.isNull())
delete m_widget.data();
m_widget.clear();
m_widget = 0;
}
void QuickToolBar::apply(TextEditor::BaseTextEditor *editor, Document::Ptr document, const ScopeChain *scopeChain, AST::Node *node, bool update, bool force)
......
......@@ -33,6 +33,8 @@
#include <qmljs/qmljsicontextpane.h>
#include <QPointer>
namespace TextEditor {
class BaseTextEditor;
}
......@@ -66,7 +68,7 @@ public slots:
private:
QmlEditorWidgets::ContextPaneWidget* contextWidget();
QWeakPointer<QmlEditorWidgets::ContextPaneWidget> m_widget;
QPointer<QmlEditorWidgets::ContextPaneWidget> m_widget;
QmlJS::Document::Ptr m_doc;
QmlJS::AST::Node *m_node;
TextEditor::BaseTextEditor *m_editor;
......
......@@ -37,7 +37,7 @@
#include <qmldebug/qv8profilerclient.h>
#include <utils/qtcassert.h>
#include <QWeakPointer>
#include <QPointer>
#include <QTimer>
#include <QMessageBox>
......@@ -54,8 +54,8 @@ public:
QmlProfilerStateManager* profilerState;
QmlDebugConnection *connection;
QWeakPointer<QmlProfilerTraceClient> qmlclientplugin;
QWeakPointer<QV8ProfilerClient> v8clientplugin;
QPointer<QmlProfilerTraceClient> qmlclientplugin;
QPointer<QV8ProfilerClient> v8clientplugin;
QTimer connectionTimer;
int connectionAttempts;
......
......@@ -36,6 +36,7 @@
#include <projectexplorer/project.h>
#include <QDeclarativeEngine>
#include <QPointer>
namespace QmlJS { class ModelManagerInterface; }
namespace Utils { class FileSystemWatcher; }
......@@ -115,7 +116,7 @@ private:
// qml based, new format
QDeclarativeEngine m_engine;
QWeakPointer<QmlProjectItem> m_projectItem;
QPointer<QmlProjectItem> m_projectItem;
Internal::QmlProjectNode *m_rootNode;
};
......
......@@ -35,7 +35,7 @@
#include <projectexplorer/runconfiguration.h>
#include <QWeakPointer>
#include <QPointer>
QT_FORWARD_DECLARE_CLASS(QStringListModel)
......@@ -125,7 +125,7 @@ private:
QString m_scriptFile;
QString m_qmlViewerArgs;
QWeakPointer<Internal::QmlProjectRunConfigurationWidget> m_configurationWidget;
QPointer<Internal::QmlProjectRunConfigurationWidget> m_configurationWidget;
bool m_isEnabled;
......
......@@ -74,7 +74,7 @@ bool BlackBerryRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runC
// not launch a second instance. Disable the Run button if the application is already
// running on the device.
if (m_activeRunControls.contains(rc->key())) {
QWeakPointer<ProjectExplorer::RunControl> activeRunControl = m_activeRunControls[rc->key()];
QPointer<ProjectExplorer::RunControl> activeRunControl = m_activeRunControls[rc->key()];
if (activeRunControl && activeRunControl.data()->isRunning())
return false;
else
......@@ -103,7 +103,7 @@ ProjectExplorer::RunControl *BlackBerryRunControlFactory::create(ProjectExplorer
if (mode == ProjectExplorer::NormalRunMode) {
BlackBerryRunControl *runControl = new BlackBerryRunControl(rc);
m_activeRunControls[rc->key()] = QWeakPointer<ProjectExplorer::RunControl>(runControl);
m_activeRunControls[rc->key()] = runControl;
return runControl;
}
......@@ -113,7 +113,7 @@ ProjectExplorer::RunControl *BlackBerryRunControlFactory::create(ProjectExplorer
return 0;
new BlackBerryDebugSupport(rc, runControl);
m_activeRunControls[rc->key()] = QWeakPointer<ProjectExplorer::RunControl>(runControl);
m_activeRunControls[rc->key()] = runControl;
return runControl;
}
......
......@@ -68,7 +68,7 @@ public:
private:
static Debugger::DebuggerStartParameters startParameters( const BlackBerryRunConfiguration *runConfig);
mutable QMap<QString, QWeakPointer<ProjectExplorer::RunControl> > m_activeRunControls;
mutable QMap<QString, QPointer<ProjectExplorer::RunControl> > m_activeRunControls;
};
} // namespace Internal
......
......@@ -52,7 +52,7 @@
#include <QMutex>
#include <QThread>
#include <QMutexLocker>
#include <QWeakPointer>
#include <QPointer>
#include <QWaitCondition>
#include <QDir>
#include <QBuffer>
......@@ -79,9 +79,9 @@ namespace Internal {
const char C_FALLBACK_ROOT[] = "ProjectsFallbackRoot";
QWeakPointer<ExamplesListModel> &examplesModelStatic()
QPointer<ExamplesListModel> &examplesModelStatic()
{
static QWeakPointer<ExamplesListModel> s_examplesModel;
static QPointer<ExamplesListModel> s_examplesModel;
return s_examplesModel;
}
......
......@@ -37,7 +37,7 @@
#include <utils/fileinprojectfinder.h>
#include <QRegExp>
#include <QWeakPointer>
#include <QPointer>
QT_FORWARD_DECLARE_CLASS(QTextCursor)
......@@ -81,7 +81,7 @@ private:
mutable QRegExp m_qtAssert;
mutable QRegExp m_qtAssertX;
mutable QRegExp m_qtTestFail;
QWeakPointer<ProjectExplorer::Project> m_project;
QPointer<ProjectExplorer::Project> m_project;
QString m_lastLine;
Utils::FileInProjectFinder m_projectFinder;
};
......
......@@ -41,7 +41,7 @@
#include <QIODevice>
#include <QMetaType>
#include <QThread>
#include <QSharedPointer>
#include <QPointer>
namespace {
......@@ -76,7 +76,7 @@ public:
Private()
{}
QWeakPointer<Thread> parserThread;
QPointer<Thread> parserThread;
QString errorString;
};
......
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