diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2013-02-20 14:33:46 -0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-27 07:09:08 +0100 |
commit | 2c51bc0289e5f4a8a2cfb4a57562633c1018ab58 (patch) | |
tree | ea39ea65c7413e3f0d7cd9bf5f268934f00ce051 /src/corelib | |
parent | f92e844b2b741d7d72a64052bea57de5aa04c3a7 (diff) |
Don't try to unload a library that isn't loaded
Both QPluginLoader::unload() and QLibrary::unload() protect against
that (they have a "did_load" member), but QFactoryLoaderPrivate's
destructor doesn't. In the past (Qt4) all plugins had to be loaded
anyway, so there was no mistake in the reference counting. With Qt 5,
we don't load plugins unless they're actually used (in
QFactoryLoader::instance).
Task-number: QTBUG-29773
Change-Id: I3278fa14bac7e26a9faaf999b4e42e950654ac9a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/plugin/qlibrary.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 236832097a..1e17c9fbd4 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -502,7 +502,7 @@ bool QLibraryPrivate::unload(UnloadFlag flag) { if (!pHnd) return false; - if (!libraryUnloadCount.deref()) { // only unload if ALL QLibrary instance wanted to + if (libraryUnloadCount.load() > 0 && !libraryUnloadCount.deref()) { // only unload if ALL QLibrary instance wanted to delete inst.data(); if (flag == NoUnloadSys || unload_sys()) { if (qt_debug_component()) |