summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
authorDmitry Shachnev <mitya57@gmail.com>2017-01-11 18:13:33 +0300
committerDmitry Shachnev <mitya57@gmail.com>2017-01-11 18:13:33 +0300
commit00dbeffd7456b5981bae412308483df144b71b6f (patch)
tree1aa7ad2237b6f4783a0d1a4ef9da611560aef779 /debian/patches
parentdf5d43adfb304f03b1295f359a05d3b6d667ccdd (diff)
downloadqtbase-00dbeffd7456b5981bae412308483df144b71b6f.tar.gz
Backport change to stop unloading plugins in QPluginLoader and QFactoryLoader.
Closes: #845662.
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/series1
-rw-r--r--debian/patches/stop_unloading_plugins.diff61
2 files changed, 62 insertions, 0 deletions
diff --git a/debian/patches/series b/debian/patches/series
index 29be622..d51af60 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,6 +5,7 @@ fix_build_on_x32.diff
gcc_6.3.diff
fix_accessibility_crash.diff
gtkdialogs_wayland.diff
+stop_unloading_plugins.diff
# Debian specific.
no_dbus_dependency.diff
diff --git a/debian/patches/stop_unloading_plugins.diff b/debian/patches/stop_unloading_plugins.diff
new file mode 100644
index 0000000..707b7df
--- /dev/null
+++ b/debian/patches/stop_unloading_plugins.diff
@@ -0,0 +1,61 @@
+Description: stop unloading plugins in QPluginLoader and QFactoryLoader
+ QPluginLoader hasn't unloaded in its destructor since Qt 5.0, but we
+ missed the equivalent code in QFactoryLoader (which bypasses
+ QPluginLoader). Besides, QPluginLoader::unload() was still doing
+ unloading, which it won't anymore.
+ .
+ Not unloading plugins is Qt's policy, as decided during the 5.0
+ development process and reaffirmed now in 5.6. This is due to static
+ data in plugins leaking out and remaining in use past the unloading of
+ the plugin, causing crashes.
+ .
+ This does not affect QLibrary and QLibrary::unload(). Those are meant
+ for non-Qt loadable modules, so unloading them may be safe.
+Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=ca4d93d85ee446c5
+Last-Update: 2017-01-11
+
+--- a/src/corelib/plugin/qfactoryloader.cpp
++++ b/src/corelib/plugin/qfactoryloader.cpp
+@@ -187,10 +187,12 @@
+ ++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
+--- a/src/corelib/plugin/qpluginloader.cpp
++++ b/src/corelib/plugin/qpluginloader.cpp
+@@ -154,6 +154,7 @@
+ : QObject(parent), d(0), did_load(false)
+ {
+ setFileName(fileName);
++ setLoadHints(QLibrary::PreventUnloadHint);
+ }
+
+ /*!
+@@ -348,7 +349,7 @@
+ 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 @@
+ \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.