summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qcoreapplication.cpp
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2022-03-04 12:28:49 +0100
committerMårten Nordheim <marten.nordheim@qt.io>2022-03-08 15:44:17 +0100
commit034d8898f8166423db085da529787e56204c8e15 (patch)
treef58e930c7880d1cd79cd39745ed366d27dcd9e55 /src/corelib/kernel/qcoreapplication.cpp
parent87725ee75981ec9ab25456c41acc74681c85ae2e (diff)
Fix deprecated uses of QScopedPointer
By changing it to unique_ptr. Pick-to: 6.2 6.3 Change-Id: I91abb69445b537d4c95983ae735341882352b29d Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qcoreapplication.cpp')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 25fdc5b546..af0be3ff75 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -134,6 +134,7 @@
#endif
#include <algorithm>
+#include <memory>
QT_BEGIN_NAMESPACE
@@ -391,8 +392,8 @@ struct QCoreApplicationData {
bool applicationVersionSet; // true if setApplicationVersion was called
#if QT_CONFIG(library)
- QScopedPointer<QStringList> app_libpaths;
- QScopedPointer<QStringList> manual_libpaths;
+ std::unique_ptr<QStringList> app_libpaths;
+ std::unique_ptr<QStringList> manual_libpaths;
#endif
};
@@ -568,7 +569,7 @@ void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver)
void QCoreApplicationPrivate::appendApplicationPathToLibraryPaths()
{
#if QT_CONFIG(library)
- QStringList *app_libpaths = coreappdata()->app_libpaths.data();
+ QStringList *app_libpaths = coreappdata()->app_libpaths.get();
if (!app_libpaths)
coreappdata()->app_libpaths.reset(app_libpaths = new QStringList);
QString app_location = QCoreApplication::applicationFilePath();
@@ -815,8 +816,8 @@ void QCoreApplicationPrivate::init()
// Reset the lib paths, so that they will be recomputed, taking the availability of argv[0]
// into account. If necessary, recompute right away and replay the manual changes on top of the
// new lib paths.
- QStringList *appPaths = coreappdata()->app_libpaths.take();
- QStringList *manualPaths = coreappdata()->manual_libpaths.take();
+ QStringList *appPaths = coreappdata()->app_libpaths.release();
+ QStringList *manualPaths = coreappdata()->manual_libpaths.release();
if (appPaths) {
if (manualPaths) {
// Replay the delta. As paths can only be prepended to the front or removed from
@@ -1612,10 +1613,10 @@ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority)
// delete the event on exceptions to protect against memory leaks till the event is
// properly owned in the postEventList
- QScopedPointer<QEvent> eventDeleter(event);
+ std::unique_ptr<QEvent> eventDeleter(event);
Q_TRACE(QCoreApplication_postEvent_event_posted, receiver, event, event->type());
data->postEventList.addEvent(QPostEvent(receiver, event, priority));
- eventDeleter.take();
+ Q_UNUSED(eventDeleter.release());
event->m_posted = true;
++receiver->d_func()->postedEvents;
data->canWait = false;
@@ -2868,14 +2869,14 @@ void QCoreApplication::addLibraryPath(const QString &path)
QMutexLocker locker(libraryPathMutex());
- QStringList *libpaths = coreappdata()->manual_libpaths.data();
+ QStringList *libpaths = coreappdata()->manual_libpaths.get();
if (libpaths) {
if (libpaths->contains(canonicalPath))
return;
} else {
// make sure that library paths are initialized
libraryPathsLocked();
- QStringList *app_libpaths = coreappdata()->app_libpaths.data();
+ QStringList *app_libpaths = coreappdata()->app_libpaths.get();
if (app_libpaths->contains(canonicalPath))
return;
@@ -2907,14 +2908,14 @@ void QCoreApplication::removeLibraryPath(const QString &path)
QMutexLocker locker(libraryPathMutex());
- QStringList *libpaths = coreappdata()->manual_libpaths.data();
+ QStringList *libpaths = coreappdata()->manual_libpaths.get();
if (libpaths) {
if (libpaths->removeAll(canonicalPath) == 0)
return;
} else {
// make sure that library paths is initialized
libraryPathsLocked();
- QStringList *app_libpaths = coreappdata()->app_libpaths.data();
+ QStringList *app_libpaths = coreappdata()->app_libpaths.get();
if (!app_libpaths->contains(canonicalPath))
return;