diff options
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r-- | src/corelib/plugin/qfactoryloader.cpp | 12 | ||||
-rw-r--r-- | src/corelib/plugin/qlibrary_win.cpp | 21 | ||||
-rw-r--r-- | src/corelib/plugin/qpluginloader.cpp | 5 | ||||
-rw-r--r-- | src/corelib/plugin/qsystemlibrary.cpp | 16 | ||||
-rw-r--r-- | src/corelib/plugin/qsystemlibrary_p.h | 4 | ||||
-rw-r--r-- | src/corelib/plugin/quuid.cpp | 33 | ||||
-rw-r--r-- | src/corelib/plugin/quuid.h | 6 | ||||
-rw-r--r-- | src/corelib/plugin/quuid_darwin.mm | 29 |
8 files changed, 46 insertions, 80 deletions
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 6cd02e3a3f..c09dc6c22b 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -108,7 +108,11 @@ void QFactoryLoader::update() if (!QDir(path).exists(QLatin1String("."))) continue; - QStringList plugins = QDir(path).entryList(QDir::Files); + QStringList plugins = QDir(path).entryList( +#ifdef Q_OS_WIN + QStringList(QStringLiteral("*.dll")), +#endif + QDir::Files); QLibraryPrivate *library = 0; #ifdef Q_OS_MAC @@ -187,10 +191,12 @@ void QFactoryLoader::update() ++keyUsageCount; } } - if (keyUsageCount || keys.isEmpty()) + if (keyUsageCount || keys.isEmpty()) { + library->setLoadHints(QLibrary::PreventUnloadHint); // once loaded, don't unload d->libraryList += library; - else + } else { library->release(); + } } } #else diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp index 46fbba151c..48aa0cdbb6 100644 --- a/src/corelib/plugin/qlibrary_win.cpp +++ b/src/corelib/plugin/qlibrary_win.cpp @@ -71,15 +71,6 @@ bool QLibraryPrivate::load_sys() #endif // We make the following attempts at locating the library: // - // WinCE - // if (absolute) - // fileName - // fileName + ".dll" - // else - // fileName + ".dll" - // fileName - // QFileInfo(fileName).absoluteFilePath() - // // Windows // if (absolute) // fileName @@ -97,14 +88,10 @@ bool QLibraryPrivate::load_sys() // If the fileName is an absolute path we try that first, otherwise we // use the system-specific suffix first QFileSystemEntry fsEntry(fileName); - if (fsEntry.isAbsolute()) { + if (fsEntry.isAbsolute()) attempts.prepend(fileName); - } else { + else attempts.append(fileName); -#if defined(Q_OS_WINCE) - attempts.append(QFileInfo(fileName).absoluteFilePath()); -#endif - } #ifdef Q_OS_WINRT if (fileName.startsWith(QLatin1Char('/'))) attempts.prepend(QDir::rootPath() + fileName); @@ -176,11 +163,7 @@ bool QLibraryPrivate::unload_sys() QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol) { -#ifdef Q_OS_WINCE - FARPROC address = GetProcAddress(pHnd, (const wchar_t*)QString::fromLatin1(symbol).utf16()); -#else FARPROC address = GetProcAddress(pHnd, symbol); -#endif if (!address) { errorString = QLibrary::tr("Cannot resolve symbol \"%1\" in %2: %3").arg( QString::fromLatin1(symbol)).arg( diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index 62067c7ef7..4752f69ff3 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -154,6 +154,7 @@ QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent) : QObject(parent), d(0), did_load(false) { setFileName(fileName); + setLoadHints(QLibrary::PreventUnloadHint); } /*! @@ -348,7 +349,7 @@ static QString locatePlugin(const QString& fileName) void QPluginLoader::setFileName(const QString &fileName) { #if defined(QT_SHARED) - QLibrary::LoadHints lh; + QLibrary::LoadHints lh = QLibrary::PreventUnloadHint; if (d) { lh = d->loadHints(); d->release(); @@ -394,7 +395,7 @@ QString QPluginLoader::errorString() const \brief Give the load() function some hints on how it should behave. You can give hints on how the symbols in the plugin are - resolved. By default, none of the hints are set. + resolved. By default since Qt 5.7, QLibrary::PreventUnloadHint is set. See the documentation of QLibrary::loadHints for a complete description of how this property works. diff --git a/src/corelib/plugin/qsystemlibrary.cpp b/src/corelib/plugin/qsystemlibrary.cpp index 178a33f987..7c80fbbd42 100644 --- a/src/corelib/plugin/qsystemlibrary.cpp +++ b/src/corelib/plugin/qsystemlibrary.cpp @@ -68,23 +68,11 @@ DLL Safe search mode is documented in the "Dynamic-Link Library Search Order" document on MSDN. - - Since library loading code is sometimes shared between Windows and WinCE, - this class can also be used on WinCE. However, its implementation just - calls the LoadLibrary() function. This is ok since it is documented as not - loading from the current directory on WinCE. This behaviour is documented - in the documentation for LoadLibrary for Windows CE at MSDN. - (http://msdn.microsoft.com/en-us/library/ms886736.aspx) */ QT_BEGIN_NAMESPACE -#if defined(Q_OS_WINCE) -HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */) -{ - return ::LoadLibrary(libraryName); -} -#elif defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */) { Q_UNUSED(onlySystemDirectory); @@ -141,6 +129,6 @@ HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirect } -#endif //Q_OS_WINCE +#endif // Q_OS_WINRT QT_END_NAMESPACE diff --git a/src/corelib/plugin/qsystemlibrary_p.h b/src/corelib/plugin/qsystemlibrary_p.h index 469376d81b..7b6d180df9 100644 --- a/src/corelib/plugin/qsystemlibrary_p.h +++ b/src/corelib/plugin/qsystemlibrary_p.h @@ -93,11 +93,7 @@ public: load(); if (!m_handle) return 0; -#ifdef Q_OS_WINCE - return QFunctionPointer(GetProcAddress(m_handle, (const wchar_t*)QString::fromLatin1(symbol).utf16())); -#else return QFunctionPointer(GetProcAddress(m_handle, symbol)); -#endif } static QFunctionPointer resolve(const QString &libraryName, const char *symbol) diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index 5876bb84c3..1780039928 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -809,39 +809,6 @@ QUuid::Version QUuid::version() const Q_DECL_NOTHROW return ver; } -/*! \fn QUuid QUuid::fromCFUUID(CFUUIDRef uuid) - \since 5.7 - - Constructs a new QUuid containing a copy of the \a uuid CFUUID. - - \note this function is only available on Apple platforms. -*/ - -/*! \fn CFUUIDRef QUuid::toCFUUID() const - \since 5.7 - - Creates a CFUUID from a QUuid. The caller owns the CFUUID and is - responsible for releasing it. - - \note this function is only available on Apple platforms. -*/ - -/*! \fn QUuid QUuid::fromNSUUID(const NSUUID *uuid) - \since 5.7 - - Constructs a new QUuid containing a copy of the \a uuid NSUUID. - - \note this function is only available on Apple platforms. -*/ - -/*! \fn NSUUID QUuid::toNSUUID() const - \since 5.7 - - Creates a NSUUID from a QUuid. The NSUUID is autoreleased. - - \note this function is only available on Apple platforms. -*/ - /*! \fn bool QUuid::operator<(const QUuid &other) const diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index a1d16b449e..fef0beba11 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -55,11 +55,9 @@ typedef struct _GUID #endif #endif -#ifdef Q_OS_DARWIN +#if defined(Q_OS_DARWIN) Q_FORWARD_DECLARE_CF_TYPE(CFUUID); -# ifdef __OBJC__ Q_FORWARD_DECLARE_OBJC_CLASS(NSUUID); -# endif #endif QT_BEGIN_NAMESPACE @@ -210,10 +208,8 @@ public: #if defined(Q_OS_DARWIN) || defined(Q_QDOC) static QUuid fromCFUUID(CFUUIDRef uuid); CFUUIDRef toCFUUID() const Q_DECL_CF_RETURNS_RETAINED; -# if defined(__OBJC__) || defined(Q_QDOC) static QUuid fromNSUUID(const NSUUID *uuid); NSUUID *toNSUUID() const Q_DECL_NS_RETURNS_AUTORELEASED; -# endif #endif uint data1; diff --git a/src/corelib/plugin/quuid_darwin.mm b/src/corelib/plugin/quuid_darwin.mm index c2a7240f3b..aa67e0b7dc 100644 --- a/src/corelib/plugin/quuid_darwin.mm +++ b/src/corelib/plugin/quuid_darwin.mm @@ -43,6 +43,13 @@ QT_BEGIN_NAMESPACE +/*! \fn QUuid QUuid::fromCFUUID(CFUUIDRef uuid) + \since 5.7 + + Constructs a new QUuid containing a copy of the \a uuid CFUUID. + + \note this function is only available on Apple platforms. +*/ QUuid QUuid::fromCFUUID(CFUUIDRef uuid) { if (!uuid) @@ -51,12 +58,27 @@ QUuid QUuid::fromCFUUID(CFUUIDRef uuid) return QUuid::fromRfc4122(QByteArray::fromRawData(reinterpret_cast<const char *>(&bytes), sizeof(bytes))); } +/*! \fn CFUUIDRef QUuid::toCFUUID() const + \since 5.7 + + Creates a CFUUID from a QUuid. The caller owns the CFUUID and is + responsible for releasing it. + + \note this function is only available on Apple platforms. +*/ CFUUIDRef QUuid::toCFUUID() const { const QByteArray bytes = toRfc4122(); return CFUUIDCreateFromUUIDBytes(0, *reinterpret_cast<const CFUUIDBytes *>(bytes.constData())); } +/*! \fn QUuid QUuid::fromNSUUID(const NSUUID *uuid) + \since 5.7 + + Constructs a new QUuid containing a copy of the \a uuid NSUUID. + + \note this function is only available on Apple platforms. +*/ QUuid QUuid::fromNSUUID(const NSUUID *uuid) { if (!uuid) @@ -66,6 +88,13 @@ QUuid QUuid::fromNSUUID(const NSUUID *uuid) return QUuid::fromRfc4122(QByteArray::fromRawData(reinterpret_cast<const char *>(bytes), sizeof(bytes))); } +/*! \fn NSUUID QUuid::toNSUUID() const + \since 5.7 + + Creates a NSUUID from a QUuid. The NSUUID is autoreleased. + + \note this function is only available on Apple platforms. +*/ NSUUID *QUuid::toNSUUID() const { const QByteArray bytes = toRfc4122(); |