Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
dev
-
None
-
3
-
e60aed5ed (dev), fae7afba3 (6.5), 30ffd6639 (6.6)
-
Foundation Sprint 86, Foundation Sprint 87
Description
The tst_QFactoryLoader::extraSearchPath() test appears to leaks QLibraryPrivate* objects stored in keyMap.
Log attached, which, at the end, shows that this is the only function with a problem, all other test functions are clean (by themselves, if run together with extraSearchPath(), the locations reported may seem to originate from other tests).
The debug output is from the patch pasted below, which indicates that it's the keyMap.clear() which is the problem, not (at least in this case) the overwriting of previous.
I don't know how the ref-counting is supposed to work vis-a-via our never-unload-plugins policy, though I guess it'll be obvious what's happening for you, thiago.
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index e3649622bd..b254738a0f 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -222,6 +222,7 @@ inline void QFactoryLoaderPrivate::updateSinglePath(const QString &path) prev_qt_version = int(previous->metaData.value(QtPluginMetaDataKeys::QtVersion).toInteger()); int qt_version = int(library->metaData.value(QtPluginMetaDataKeys::QtVersion).toInteger()); if (!previous || (prev_qt_version > QtVersionNoPatch && qt_version <= QtVersionNoPatch)) { + qDebug("%s: %p leaked?", Q_FUNC_INFO, previous); keyMap[key] = library.get(); // we WILL .release() ++keyUsageCount; } @@ -329,6 +330,9 @@ void QFactoryLoader::setExtraSearchPath(const QString &path) // must re-scan everything d->loadedPaths.clear(); d->libraryList.clear(); + qDebug("%s: leaking %lld objects?", Q_FUNC_INFO, qlonglong(d->keyMap.size())); + for (auto p : std::as_const(d->keyMap)) + qDebug("%s: candidate: %p", Q_FUNC_INFO, p); d->keyMap.clear(); update(); }
Attachments
Issue Links
- clones
-
QTBUG-115257 cross-thread QTimer::singleShot() potential memleak
-
- Closed
-
For Gerrit Dashboard: QTBUG-115286 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
491686,7 | QFactoryLoader: fix mem-leak on setExtraSearchPath() | dev | qt/qtbase | Status: MERGED | +2 | 0 |
492343,2 | QFactoryLoader: fix mem-leak on setExtraSearchPath() | 6.5 | qt/qtbase | Status: MERGED | +2 | 0 |
492344,2 | QFactoryLoader: fix mem-leak on setExtraSearchPath() | 6.6 | qt/qtbase | Status: MERGED | +2 | 0 |