diff options
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 13 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.h | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qpointer.h | 15 |
3 files changed, 16 insertions, 15 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 6647ea99f5..c537e8f51b 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2693,7 +2693,14 @@ Q_GLOBAL_STATIC(QRecursiveMutex, libraryPathMutex) QStringList QCoreApplication::libraryPaths() { QMutexLocker locker(libraryPathMutex()); + return libraryPathsLocked(); +} +/*! + \internal +*/ +QStringList QCoreApplication::libraryPathsLocked() +{ if (coreappdata()->manual_libpaths) return *(coreappdata()->manual_libpaths); @@ -2769,7 +2776,7 @@ void QCoreApplication::setLibraryPaths(const QStringList &paths) // When the application is constructed it should still amend the paths. So we keep the originals // around, and even create them if they don't exist, yet. if (!coreappdata()->app_libpaths) - libraryPaths(); + libraryPathsLocked(); if (coreappdata()->manual_libpaths) *(coreappdata()->manual_libpaths) = paths; @@ -2812,7 +2819,7 @@ void QCoreApplication::addLibraryPath(const QString &path) return; } else { // make sure that library paths are initialized - libraryPaths(); + libraryPathsLocked(); QStringList *app_libpaths = coreappdata()->app_libpaths.data(); if (app_libpaths->contains(canonicalPath)) return; @@ -2851,7 +2858,7 @@ void QCoreApplication::removeLibraryPath(const QString &path) return; } else { // make sure that library paths is initialized - libraryPaths(); + libraryPathsLocked(); QStringList *app_libpaths = coreappdata()->app_libpaths.data(); if (!app_libpaths->contains(canonicalPath)) return; diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index b7df004736..71ea124fbe 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -208,6 +208,9 @@ private: static bool notifyInternal2(QObject *receiver, QEvent *); static bool forwardEvent(QObject *receiver, QEvent *event, QEvent *originatingEvent = nullptr); #endif +#if QT_CONFIG(library) + static QStringList libraryPathsLocked(); +#endif static QCoreApplication *self; diff --git a/src/corelib/kernel/qpointer.h b/src/corelib/kernel/qpointer.h index 7052bcf0d4..5efdb0b395 100644 --- a/src/corelib/kernel/qpointer.h +++ b/src/corelib/kernel/qpointer.h @@ -54,20 +54,11 @@ class QPointer { Q_STATIC_ASSERT_X(!std::is_pointer<T>::value, "QPointer's template type must not be a pointer type"); - template<typename U> - struct TypeSelector - { - typedef QObject Type; - }; - template<typename U> - struct TypeSelector<const U> - { - typedef const QObject Type; - }; - typedef typename TypeSelector<T>::Type QObjectType; + using QObjectType = + typename std::conditional<std::is_const<T>::value, const QObject, QObject>::type; QWeakPointer<QObjectType> wp; public: - inline QPointer() { } + QPointer() = default; inline QPointer(T *p) : wp(p, true) { } // compiler-generated copy/move ctor/assignment operators are fine! // compiler-generated dtor is fine! |