Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-themes/qtcurve/files/, x11-themes/qtcurve/
Date: Sat, 02 Jun 2018 12:54:41
Message-Id: 1527944073.987bac35e9eb0edf61387f4e42c1cb41f2df64e7.polynomial-c@gentoo
1 commit: 987bac35e9eb0edf61387f4e42c1cb41f2df64e7
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jun 2 12:54:08 2018 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Sat Jun 2 12:54:33 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=987bac35
7
8 x11-themes/qtcurve: Revbump to add a fix against a rare crash/hang.
9
10 Thanks-to: Andreas Sturmlechner <asturm <AT> gentoo.org>
11 Package-Manager: Portage-2.3.40, Repoman-2.3.9
12
13 .../files/qtcurve-1.9.0-rare_crash_hang_fix.patch | 238 +++++++++++++++++++++
14 x11-themes/qtcurve/qtcurve-1.9.0_rc1-r2.ebuild | 94 ++++++++
15 2 files changed, 332 insertions(+)
16
17 diff --git a/x11-themes/qtcurve/files/qtcurve-1.9.0-rare_crash_hang_fix.patch b/x11-themes/qtcurve/files/qtcurve-1.9.0-rare_crash_hang_fix.patch
18 new file mode 100644
19 index 00000000000..921001f4454
20 --- /dev/null
21 +++ b/x11-themes/qtcurve/files/qtcurve-1.9.0-rare_crash_hang_fix.patch
22 @@ -0,0 +1,238 @@
23 +From b7da5ec7e2965332e3922dfb03a3d100aa203b94 Mon Sep 17 00:00:00 2001
24 +From: =?UTF-8?q?Ren=C3=A9=20J=2EV=2E=20Bertin?= <rjvbertin@×××××.com>
25 +Date: Fri, 8 Dec 2017 10:10:47 +0100
26 +Subject: address a rare crash/hang on exit
27 +
28 +Under rare circumstances Qt would attempt to deliver signals to stale
29 +style instances, or leave orphaned style instances after unloading the
30 +plugin. This is addressed by disconnecting the (currently only) signal
31 +originating from an external application and the plugin now ensures it
32 +leaves no orphaned style instances behind.
33 +Also, moves the code handling pre-exit disconnection to a subclass.
34 +
35 +Differential Revision: https://phabricator.kde.org/D9229
36 +---
37 + qt5/style/qtcurve.cpp | 72 ++++++++++++++++++++++++++++++++------------
38 + qt5/style/qtcurve.h | 5 +--
39 + qt5/style/qtcurve_plugin.cpp | 15 ++++++---
40 + 3 files changed, 67 insertions(+), 25 deletions(-)
41 +
42 +diff --git a/qt5/style/qtcurve.cpp b/qt5/style/qtcurve.cpp
43 +index 1bf6e1d..07eca0f 100644
44 +--- a/qt5/style/qtcurve.cpp
45 ++++ b/qt5/style/qtcurve.cpp
46 +@@ -101,6 +101,26 @@
47 +
48 + namespace QtCurve {
49 +
50 ++class Style::DBusHelper {
51 ++public:
52 ++ DBusHelper()
53 ++ : m_dBus(0)
54 ++ , m_dbusConnected(false)
55 ++ {}
56 ++ ~DBusHelper()
57 ++ {
58 ++ if (m_dBus) {
59 ++ m_dBus->disconnect();
60 ++ m_dBus->deleteLater();
61 ++ m_dBus = 0;
62 ++ }
63 ++ }
64 ++
65 ++ std::once_flag m_aboutToQuitInit;
66 ++ QDBusInterface *m_dBus;
67 ++ bool m_dbusConnected;
68 ++};
69 ++
70 + static inline void setPainterPen(QPainter *p, const QColor &col, const qreal width=1.0)
71 + {
72 + p->setPen(QPen(col, width));
73 +@@ -321,6 +341,7 @@ static void parseWindowLine(const QString &line, QList<int> &data)
74 + #endif
75 +
76 + Style::Style() :
77 ++ m_dBusHelper(new DBusHelper()),
78 + m_popupMenuCols(0L),
79 + m_sliderCols(0L),
80 + m_defBtnCols(0L),
81 +@@ -343,13 +364,11 @@ Style::Style() :
82 + m_progressBarAnimateTimer(0),
83 + m_animateStep(0),
84 + m_titlebarHeight(0),
85 +- m_dBus(0),
86 + m_shadowHelper(new ShadowHelper(this)),
87 + m_sViewSBar(0L),
88 + m_windowManager(new WindowManager(this)),
89 + m_blurHelper(new BlurHelper(this)),
90 +- m_shortcutHandler(new ShortcutHandler(this)),
91 +- m_dbusConnected(false)
92 ++ m_shortcutHandler(new ShortcutHandler(this))
93 + {
94 + const char *env = getenv(QTCURVE_PREVIEW_CONFIG);
95 + #ifdef QTC_QT5_ENABLE_KDE
96 +@@ -394,6 +413,23 @@ void Style::init(bool initial)
97 + #ifdef QTC_QT5_ENABLE_KDE
98 + connect(KWindowSystem::self(), &KWindowSystem::compositingChanged, this, &Style::compositingToggled);
99 + #endif
100 ++ // prepare the cleanup handler
101 ++ if (QCoreApplication::instance()) {
102 ++ std::call_once(m_dBusHelper->m_aboutToQuitInit, [this] {
103 ++ connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, [this] () {
104 ++ // disconnect from the session DBus. We're no longer interested in the
105 ++ // information it might send when the app we're serving is shutting down.
106 ++ disconnectDBus();
107 ++ // Stop listening to select signals. We shouldn't stop emitting signals
108 ++ // (like QObject::destroyed) but we can reduce the likelihood that pending
109 ++ // signals will be sent to us post-mortem.
110 ++#ifdef QTC_QT5_ENABLE_KDE
111 ++ disconnect(KWindowSystem::self(), &KWindowSystem::compositingChanged,
112 ++ this, &Style::compositingToggled);
113 ++#endif
114 ++ } );
115 ++ } );
116 ++ }
117 + }
118 + }
119 +
120 +@@ -663,14 +699,11 @@ void Style::init(bool initial)
121 +
122 + void Style::connectDBus()
123 + {
124 +- if (m_dbusConnected)
125 ++ if (m_dBusHelper->m_dbusConnected)
126 + return;
127 + auto bus = QDBusConnection::sessionBus();
128 + if (bus.isConnected()) {
129 +- m_dbusConnected = true;
130 +- if (QCoreApplication::instance()) {
131 +- connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &Style::disconnectDBus);
132 +- }
133 ++ m_dBusHelper->m_dbusConnected = true;
134 + bus.connect(QString(), "/KGlobalSettings", "org.kde.KGlobalSettings",
135 + "notifyChange", this, SLOT(kdeGlobalSettingsChange(int, int)));
136 + #ifndef QTC_QT5_ENABLE_KDE
137 +@@ -699,12 +732,15 @@ void Style::connectDBus()
138 +
139 + void Style::disconnectDBus()
140 + {
141 +- if (!m_dbusConnected)
142 ++ if (!m_dBusHelper->m_dbusConnected)
143 + return;
144 +- m_dbusConnected = false;
145 + auto bus = QDBusConnection::sessionBus();
146 ++ if (!bus.isConnected())
147 ++ return;
148 ++ m_dBusHelper->m_dbusConnected = false;
149 + if (getenv("QTCURVE_DEBUG")) {
150 + qWarning() << Q_FUNC_INFO << this << "Disconnecting from" << bus.name() << "/" << bus.baseService();
151 ++ dumpObjectInfo();
152 + }
153 + bus.disconnect(QString(), "/KGlobalSettings", "org.kde.KGlobalSettings",
154 + "notifyChange",
155 +@@ -739,9 +775,7 @@ Style::~Style()
156 + m_plugin->m_styleInstances.removeAll(this);
157 + }
158 + freeColors();
159 +- if (m_dBus) {
160 +- delete m_dBus;
161 +- }
162 ++ delete m_dBusHelper;
163 + }
164 +
165 + void Style::freeColor(QSet<QColor *> &freedColors, QColor **cols)
166 +@@ -4467,10 +4501,10 @@ void Style::emitMenuSize(QWidget *w, unsigned short size, bool force)
167 + if (oldSize != size) {
168 + w->setProperty(constMenuSizeProperty, size);
169 + qtcX11SetMenubarSize(wid, size);
170 +- if(!m_dBus)
171 +- m_dBus = new QDBusInterface("org.kde.kwin", "/QtCurve",
172 ++ if(!m_dBusHelper->m_dBus)
173 ++ m_dBusHelper->m_dBus = new QDBusInterface("org.kde.kwin", "/QtCurve",
174 + "org.kde.QtCurve");
175 +- m_dBus->call(QDBus::NoBlock, "menuBarSize",
176 ++ m_dBusHelper->m_dBus->call(QDBus::NoBlock, "menuBarSize",
177 + (unsigned int)wid, (int)size);
178 + }
179 + }
180 +@@ -4479,10 +4513,10 @@ void Style::emitMenuSize(QWidget *w, unsigned short size, bool force)
181 + void Style::emitStatusBarState(QStatusBar *sb)
182 + {
183 + if (opts.statusbarHiding & HIDE_KWIN) {
184 +- if (!m_dBus)
185 +- m_dBus = new QDBusInterface("org.kde.kwin", "/QtCurve",
186 ++ if (!m_dBusHelper->m_dBus)
187 ++ m_dBusHelper->m_dBus = new QDBusInterface("org.kde.kwin", "/QtCurve",
188 + "org.kde.QtCurve");
189 +- m_dBus->call(QDBus::NoBlock, "statusBarState",
190 ++ m_dBusHelper->m_dBus->call(QDBus::NoBlock, "statusBarState",
191 + (unsigned int)qtcGetWid(sb->window()),
192 + sb->isVisible());
193 + }
194 +diff --git a/qt5/style/qtcurve.h b/qt5/style/qtcurve.h
195 +index 56960a5..ecfa2e7 100644
196 +--- a/qt5/style/qtcurve.h
197 ++++ b/qt5/style/qtcurve.h
198 +@@ -522,6 +522,9 @@ private:
199 + const QWidget *widget) const;
200 +
201 + private:
202 ++ class DBusHelper;
203 ++ DBusHelper *m_dBusHelper;
204 ++
205 + mutable Options opts;
206 + QColor m_highlightCols[TOTAL_SHADES + 1],
207 + m_backgroundCols[TOTAL_SHADES + 1],
208 +@@ -564,14 +567,12 @@ private:
209 + mutable QList<int> m_mdiButtons[2]; // 0=left, 1=right
210 + mutable int m_titlebarHeight;
211 +
212 +- QDBusInterface *m_dBus;
213 + ShadowHelper *m_shadowHelper;
214 + mutable QScrollBar *m_sViewSBar;
215 + mutable QMap<QWidget*, QSet<QWidget*> > m_sViewContainers;
216 + WindowManager *m_windowManager;
217 + BlurHelper *m_blurHelper;
218 + ShortcutHandler *m_shortcutHandler;
219 +- bool m_dbusConnected;
220 + #ifdef QTC_QT5_ENABLE_KDE
221 + KSharedConfigPtr m_configFile;
222 + KSharedConfigPtr m_kdeGlobals;
223 +diff --git a/qt5/style/qtcurve_plugin.cpp b/qt5/style/qtcurve_plugin.cpp
224 +index ce363ac..481fffc 100644
225 +--- a/qt5/style/qtcurve_plugin.cpp
226 ++++ b/qt5/style/qtcurve_plugin.cpp
227 +@@ -129,6 +129,11 @@ StylePlugin::create(const QString &key)
228 + if (key.toLower() == "qtcurve") {
229 + qtc = new Style;
230 + qtc->m_plugin = this;
231 ++ // keep track of all style instances we allocate, for instance
232 ++ // for KLineEdit widgets which apparently insist on overriding
233 ++ // certain things (cf. KLineEditStyle). We want to be able to
234 ++ // delete those instances as properly and as early as
235 ++ // possible during the global destruction phase.
236 + m_styleInstances << qtc;
237 + } else {
238 + qtc = nullptr;
239 +@@ -151,12 +156,14 @@ StylePlugin::~StylePlugin()
240 + qtcInfo("Deleting QtCurve plugin (%p)\n", this);
241 + if (!m_styleInstances.isEmpty()) {
242 + qtcWarn("there remain(s) %d Style instance(s)\n", m_styleInstances.count());
243 +- QList<Style*>::Iterator it = m_styleInstances.begin();
244 +- while (it != m_styleInstances.end()) {
245 +- Style *that = *it;
246 +- it = m_styleInstances.erase(it);
247 ++ foreach (Style *that, m_styleInstances) {
248 ++ // don't let ~Style() touch m_styleInstances from here.
249 ++ that->m_plugin = nullptr;
250 ++ // each instance should already have disconnected from the D-Bus
251 ++ // and disconnected from receiving select signals.
252 + delete that;
253 + }
254 ++ m_styleInstances.clear();
255 + }
256 + if (firstPlInstance == this) {
257 + firstPlInstance = nullptr;
258 +--
259 +cgit v0.11.2
260 +
261
262 diff --git a/x11-themes/qtcurve/qtcurve-1.9.0_rc1-r2.ebuild b/x11-themes/qtcurve/qtcurve-1.9.0_rc1-r2.ebuild
263 new file mode 100644
264 index 00000000000..08539806e18
265 --- /dev/null
266 +++ b/x11-themes/qtcurve/qtcurve-1.9.0_rc1-r2.ebuild
267 @@ -0,0 +1,94 @@
268 +# Copyright 1999-2018 Gentoo Foundation
269 +# Distributed under the terms of the GNU General Public License v2
270 +
271 +EAPI=6
272 +
273 +KDE_AUTODEPS="false"
274 +inherit kde5
275 +
276 +DESCRIPTION="Widget styles for Qt and GTK2"
277 +HOMEPAGE="https://cgit.kde.org/qtcurve.git"
278 +
279 +LICENSE="LGPL-2+"
280 +SLOT="0"
281 +IUSE="+X gtk nls plasma qt4 +qt5 test"
282 +
283 +if [[ "${PV}" != 9999 ]] ; then
284 + SRC_URI="https://github.com/KDE/qtcurve/archive/${PV/_/-}.tar.gz -> ${P}.tar.gz"
285 + KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
286 + S="${WORKDIR}/${P/_/-}"
287 +fi
288 +
289 +REQUIRED_USE="gtk? ( X )
290 + || ( gtk qt4 qt5 )
291 + plasma? ( qt5 )
292 +"
293 +
294 +COMMON_DEPEND="
295 + gtk? ( x11-libs/gtk+:2 )
296 + qt4? (
297 + dev-qt/qtcore:4
298 + dev-qt/qtdbus:4
299 + dev-qt/qtgui:4
300 + dev-qt/qtsvg:4
301 + )
302 + qt5? (
303 + $(add_qt_dep qtdbus)
304 + $(add_qt_dep qtgui)
305 + $(add_qt_dep qtsvg)
306 + $(add_qt_dep qtwidgets)
307 + $(add_qt_dep qtx11extras)
308 + )
309 + plasma? (
310 + $(add_frameworks_dep frameworkintegration)
311 + $(add_frameworks_dep karchive)
312 + $(add_frameworks_dep kcompletion)
313 + $(add_frameworks_dep kconfig)
314 + $(add_frameworks_dep kconfigwidgets)
315 + $(add_frameworks_dep kcoreaddons)
316 + $(add_frameworks_dep kdelibs4support)
317 + $(add_frameworks_dep kguiaddons)
318 + $(add_frameworks_dep ki18n)
319 + $(add_frameworks_dep kiconthemes)
320 + $(add_frameworks_dep kio)
321 + $(add_frameworks_dep kwidgetsaddons)
322 + $(add_frameworks_dep kwindowsystem)
323 + $(add_frameworks_dep kxmlgui)
324 + $(add_qt_dep qtprintsupport)
325 + )
326 + X? (
327 + x11-libs/libX11
328 + x11-libs/libxcb
329 + )
330 +"
331 +DEPEND="${COMMON_DEPEND}
332 + virtual/pkgconfig
333 + nls? ( sys-devel/gettext )
334 +"
335 +RDEPEND="${COMMON_DEPEND}
336 + !x11-themes/gtk-engines-qtcurve
337 +"
338 +
339 +DOCS=( AUTHORS ChangeLog.md README.md TODO.md )
340 +
341 +PATCHES=(
342 + "${FILESDIR}/${PN}-1.9.0-rare_crash_hang_fix.patch"
343 +)
344 +
345 +src_configure() {
346 + local mycmakeargs=(
347 + -DLIB_INSTALL_DIR="$(get_libdir)"
348 + -DQTC_QT4_ENABLE_KDE=OFF
349 + -DQTC_QT4_ENABLE_KWIN=OFF
350 + -DQTC_KDE4_DEFAULT_HOME=ON
351 + -DENABLE_GTK2="$(usex gtk)"
352 + -DENABLE_QT4="$(usex qt4)"
353 + -DENABLE_QT5="$(usex qt5)"
354 + -DENABLE_TEST="$(usex test)"
355 + -DQTC_ENABLE_X11="$(usex X)"
356 + -DQTC_INSTALL_PO="$(usex nls)"
357 + -DQTC_QT5_ENABLE_KDE="$(usex plasma)"
358 + )
359 +
360 + kde5_src_configure
361 +}