From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1027535-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id B9D88138334
	for <garchives@archives.gentoo.org>; Sat,  2 Jun 2018 12:54:41 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id BD14DE06FE;
	Sat,  2 Jun 2018 12:54:40 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 79874E06FE
	for <gentoo-commits@lists.gentoo.org>; Sat,  2 Jun 2018 12:54:40 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 32FEC335C75
	for <gentoo-commits@lists.gentoo.org>; Sat,  2 Jun 2018 12:54:39 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 9CFBA291
	for <gentoo-commits@lists.gentoo.org>; Sat,  2 Jun 2018 12:54:37 +0000 (UTC)
From: "Lars Wendler" <polynomial-c@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Lars Wendler" <polynomial-c@gentoo.org>
Message-ID: <1527944073.987bac35e9eb0edf61387f4e42c1cb41f2df64e7.polynomial-c@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-themes/qtcurve/files/, x11-themes/qtcurve/
X-VCS-Repository: repo/gentoo
X-VCS-Files: x11-themes/qtcurve/files/qtcurve-1.9.0-rare_crash_hang_fix.patch x11-themes/qtcurve/qtcurve-1.9.0_rc1-r2.ebuild
X-VCS-Directories: x11-themes/qtcurve/files/ x11-themes/qtcurve/
X-VCS-Committer: polynomial-c
X-VCS-Committer-Name: Lars Wendler
X-VCS-Revision: 987bac35e9eb0edf61387f4e42c1cb41f2df64e7
X-VCS-Branch: master
Date: Sat,  2 Jun 2018 12:54:37 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: d786b90f-3091-480a-ba24-eed03f875201
X-Archives-Hash: aa357a014f574ff98fe652272fb0c65d

commit:     987bac35e9eb0edf61387f4e42c1cb41f2df64e7
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Sat Jun  2 12:54:08 2018 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Sat Jun  2 12:54:33 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=987bac35

x11-themes/qtcurve: Revbump to add a fix against a rare crash/hang.

Thanks-to: Andreas Sturmlechner <asturm <AT> gentoo.org>
Package-Manager: Portage-2.3.40, Repoman-2.3.9

 .../files/qtcurve-1.9.0-rare_crash_hang_fix.patch  | 238 +++++++++++++++++++++
 x11-themes/qtcurve/qtcurve-1.9.0_rc1-r2.ebuild     |  94 ++++++++
 2 files changed, 332 insertions(+)

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
new file mode 100644
index 00000000000..921001f4454
--- /dev/null
+++ b/x11-themes/qtcurve/files/qtcurve-1.9.0-rare_crash_hang_fix.patch
@@ -0,0 +1,238 @@
+From b7da5ec7e2965332e3922dfb03a3d100aa203b94 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ren=C3=A9=20J=2EV=2E=20Bertin?= <rjvbertin@gmail.com>
+Date: Fri, 8 Dec 2017 10:10:47 +0100
+Subject: address a rare crash/hang on exit
+
+Under rare circumstances Qt would attempt to deliver signals to stale
+style instances, or leave orphaned style instances after unloading the
+plugin. This is addressed by disconnecting the (currently only) signal
+originating from an external application and the plugin now ensures it
+leaves no orphaned style instances behind.
+Also, moves the code handling pre-exit disconnection to a subclass.
+
+Differential Revision: https://phabricator.kde.org/D9229
+---
+ qt5/style/qtcurve.cpp        | 72 ++++++++++++++++++++++++++++++++------------
+ qt5/style/qtcurve.h          |  5 +--
+ qt5/style/qtcurve_plugin.cpp | 15 ++++++---
+ 3 files changed, 67 insertions(+), 25 deletions(-)
+
+diff --git a/qt5/style/qtcurve.cpp b/qt5/style/qtcurve.cpp
+index 1bf6e1d..07eca0f 100644
+--- a/qt5/style/qtcurve.cpp
++++ b/qt5/style/qtcurve.cpp
+@@ -101,6 +101,26 @@
+ 
+ namespace QtCurve {
+ 
++class Style::DBusHelper {
++public:
++    DBusHelper()
++        : m_dBus(0)
++        , m_dbusConnected(false)
++    {}
++    ~DBusHelper()
++    {
++        if (m_dBus) {
++            m_dBus->disconnect();
++            m_dBus->deleteLater();
++            m_dBus = 0;
++        }
++    }
++
++    std::once_flag m_aboutToQuitInit;
++    QDBusInterface *m_dBus;
++    bool m_dbusConnected;
++};
++
+ static inline void setPainterPen(QPainter *p, const QColor &col, const qreal width=1.0)
+ {
+     p->setPen(QPen(col, width));
+@@ -321,6 +341,7 @@ static void parseWindowLine(const QString &line, QList<int> &data)
+ #endif
+ 
+ Style::Style() :
++    m_dBusHelper(new DBusHelper()),
+     m_popupMenuCols(0L),
+     m_sliderCols(0L),
+     m_defBtnCols(0L),
+@@ -343,13 +364,11 @@ Style::Style() :
+     m_progressBarAnimateTimer(0),
+     m_animateStep(0),
+     m_titlebarHeight(0),
+-    m_dBus(0),
+     m_shadowHelper(new ShadowHelper(this)),
+     m_sViewSBar(0L),
+     m_windowManager(new WindowManager(this)),
+     m_blurHelper(new BlurHelper(this)),
+-    m_shortcutHandler(new ShortcutHandler(this)),
+-    m_dbusConnected(false)
++    m_shortcutHandler(new ShortcutHandler(this))
+ {
+     const char *env = getenv(QTCURVE_PREVIEW_CONFIG);
+ #ifdef QTC_QT5_ENABLE_KDE
+@@ -394,6 +413,23 @@ void Style::init(bool initial)
+ #ifdef QTC_QT5_ENABLE_KDE
+             connect(KWindowSystem::self(), &KWindowSystem::compositingChanged, this, &Style::compositingToggled);
+ #endif
++            // prepare the cleanup handler
++            if (QCoreApplication::instance()) {
++                std::call_once(m_dBusHelper->m_aboutToQuitInit, [this] {
++                    connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, [this] () {
++                            // disconnect from the session DBus. We're no longer interested in the
++                            // information it might send when the app we're serving is shutting down.
++                            disconnectDBus();
++                            // Stop listening to select signals. We shouldn't stop emitting signals
++                            // (like QObject::destroyed) but we can reduce the likelihood that pending
++                            // signals will be sent to us post-mortem.
++#ifdef QTC_QT5_ENABLE_KDE
++                            disconnect(KWindowSystem::self(), &KWindowSystem::compositingChanged,
++                                       this, &Style::compositingToggled);
++#endif
++                        } );
++                } );
++            }
+         }
+     }
+ 
+@@ -663,14 +699,11 @@ void Style::init(bool initial)
+ 
+ void Style::connectDBus()
+ {
+-    if (m_dbusConnected)
++    if (m_dBusHelper->m_dbusConnected)
+         return;
+     auto bus = QDBusConnection::sessionBus();
+     if (bus.isConnected()) {
+-        m_dbusConnected = true;
+-        if (QCoreApplication::instance()) {
+-            connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &Style::disconnectDBus);
+-        }
++        m_dBusHelper->m_dbusConnected = true;
+         bus.connect(QString(), "/KGlobalSettings", "org.kde.KGlobalSettings",
+                     "notifyChange", this, SLOT(kdeGlobalSettingsChange(int, int)));
+ #ifndef QTC_QT5_ENABLE_KDE
+@@ -699,12 +732,15 @@ void Style::connectDBus()
+ 
+ void Style::disconnectDBus()
+ {
+-    if (!m_dbusConnected)
++    if (!m_dBusHelper->m_dbusConnected)
+         return;
+-    m_dbusConnected = false;
+     auto bus = QDBusConnection::sessionBus();
++    if (!bus.isConnected())
++        return;
++    m_dBusHelper->m_dbusConnected = false;
+     if (getenv("QTCURVE_DEBUG")) {
+         qWarning() << Q_FUNC_INFO << this << "Disconnecting from" << bus.name() << "/" << bus.baseService();
++        dumpObjectInfo();
+     }
+     bus.disconnect(QString(), "/KGlobalSettings", "org.kde.KGlobalSettings",
+                    "notifyChange",
+@@ -739,9 +775,7 @@ Style::~Style()
+         m_plugin->m_styleInstances.removeAll(this);
+     }
+     freeColors();
+-    if (m_dBus) {
+-        delete m_dBus;
+-    }
++    delete m_dBusHelper;
+ }
+ 
+ void Style::freeColor(QSet<QColor *> &freedColors, QColor **cols)
+@@ -4467,10 +4501,10 @@ void Style::emitMenuSize(QWidget *w, unsigned short size, bool force)
+         if (oldSize != size) {
+             w->setProperty(constMenuSizeProperty, size);
+             qtcX11SetMenubarSize(wid, size);
+-            if(!m_dBus)
+-                m_dBus = new QDBusInterface("org.kde.kwin", "/QtCurve",
++            if(!m_dBusHelper->m_dBus)
++                m_dBusHelper->m_dBus = new QDBusInterface("org.kde.kwin", "/QtCurve",
+                                              "org.kde.QtCurve");
+-            m_dBus->call(QDBus::NoBlock, "menuBarSize",
++            m_dBusHelper->m_dBus->call(QDBus::NoBlock, "menuBarSize",
+                           (unsigned int)wid, (int)size);
+         }
+     }
+@@ -4479,10 +4513,10 @@ void Style::emitMenuSize(QWidget *w, unsigned short size, bool force)
+ void Style::emitStatusBarState(QStatusBar *sb)
+ {
+     if (opts.statusbarHiding & HIDE_KWIN) {
+-        if (!m_dBus)
+-            m_dBus = new QDBusInterface("org.kde.kwin", "/QtCurve",
++        if (!m_dBusHelper->m_dBus)
++            m_dBusHelper->m_dBus = new QDBusInterface("org.kde.kwin", "/QtCurve",
+                                         "org.kde.QtCurve");
+-        m_dBus->call(QDBus::NoBlock, "statusBarState",
++        m_dBusHelper->m_dBus->call(QDBus::NoBlock, "statusBarState",
+                      (unsigned int)qtcGetWid(sb->window()),
+                      sb->isVisible());
+     }
+diff --git a/qt5/style/qtcurve.h b/qt5/style/qtcurve.h
+index 56960a5..ecfa2e7 100644
+--- a/qt5/style/qtcurve.h
++++ b/qt5/style/qtcurve.h
+@@ -522,6 +522,9 @@ private:
+                                       const QWidget *widget) const;
+ 
+ private:
++    class DBusHelper;
++    DBusHelper *m_dBusHelper;
++
+     mutable Options opts;
+     QColor m_highlightCols[TOTAL_SHADES + 1],
+         m_backgroundCols[TOTAL_SHADES + 1],
+@@ -564,14 +567,12 @@ private:
+     mutable QList<int> m_mdiButtons[2]; // 0=left, 1=right
+     mutable int m_titlebarHeight;
+ 
+-    QDBusInterface *m_dBus;
+     ShadowHelper *m_shadowHelper;
+     mutable QScrollBar *m_sViewSBar;
+     mutable QMap<QWidget*, QSet<QWidget*> > m_sViewContainers;
+     WindowManager *m_windowManager;
+     BlurHelper *m_blurHelper;
+     ShortcutHandler *m_shortcutHandler;
+-    bool m_dbusConnected;
+ #ifdef QTC_QT5_ENABLE_KDE
+     KSharedConfigPtr m_configFile;
+     KSharedConfigPtr m_kdeGlobals;
+diff --git a/qt5/style/qtcurve_plugin.cpp b/qt5/style/qtcurve_plugin.cpp
+index ce363ac..481fffc 100644
+--- a/qt5/style/qtcurve_plugin.cpp
++++ b/qt5/style/qtcurve_plugin.cpp
+@@ -129,6 +129,11 @@ StylePlugin::create(const QString &key)
+     if (key.toLower() == "qtcurve") {
+         qtc = new Style;
+         qtc->m_plugin = this;
++        // keep track of all style instances we allocate, for instance
++        // for KLineEdit widgets which apparently insist on overriding
++        // certain things (cf. KLineEditStyle). We want to be able to
++        // delete those instances as properly and as early as
++        // possible during the global destruction phase.
+         m_styleInstances << qtc;
+     } else {
+         qtc = nullptr;
+@@ -151,12 +156,14 @@ StylePlugin::~StylePlugin()
+     qtcInfo("Deleting QtCurve plugin (%p)\n", this);
+     if (!m_styleInstances.isEmpty()) {
+         qtcWarn("there remain(s) %d Style instance(s)\n", m_styleInstances.count());
+-        QList<Style*>::Iterator it = m_styleInstances.begin();
+-        while (it != m_styleInstances.end()) {
+-            Style *that = *it;
+-            it = m_styleInstances.erase(it);
++        foreach (Style *that, m_styleInstances) {
++            // don't let ~Style() touch m_styleInstances from here.
++            that->m_plugin = nullptr;
++            // each instance should already have disconnected from the D-Bus
++            // and disconnected from receiving select signals.
+             delete that;
+         }
++        m_styleInstances.clear();
+     }
+     if (firstPlInstance == this) {
+         firstPlInstance = nullptr;
+-- 
+cgit v0.11.2
+

diff --git a/x11-themes/qtcurve/qtcurve-1.9.0_rc1-r2.ebuild b/x11-themes/qtcurve/qtcurve-1.9.0_rc1-r2.ebuild
new file mode 100644
index 00000000000..08539806e18
--- /dev/null
+++ b/x11-themes/qtcurve/qtcurve-1.9.0_rc1-r2.ebuild
@@ -0,0 +1,94 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+KDE_AUTODEPS="false"
+inherit kde5
+
+DESCRIPTION="Widget styles for Qt and GTK2"
+HOMEPAGE="https://cgit.kde.org/qtcurve.git"
+
+LICENSE="LGPL-2+"
+SLOT="0"
+IUSE="+X gtk nls plasma qt4 +qt5 test"
+
+if [[ "${PV}" != 9999 ]] ; then
+	SRC_URI="https://github.com/KDE/qtcurve/archive/${PV/_/-}.tar.gz -> ${P}.tar.gz"
+	KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
+	S="${WORKDIR}/${P/_/-}"
+fi
+
+REQUIRED_USE="gtk? ( X )
+	|| ( gtk qt4 qt5 )
+	plasma? ( qt5 )
+"
+
+COMMON_DEPEND="
+	gtk? ( x11-libs/gtk+:2 )
+	qt4? (
+		dev-qt/qtcore:4
+		dev-qt/qtdbus:4
+		dev-qt/qtgui:4
+		dev-qt/qtsvg:4
+	)
+	qt5? (
+		$(add_qt_dep qtdbus)
+		$(add_qt_dep qtgui)
+		$(add_qt_dep qtsvg)
+		$(add_qt_dep qtwidgets)
+		$(add_qt_dep qtx11extras)
+	)
+	plasma? (
+		$(add_frameworks_dep frameworkintegration)
+		$(add_frameworks_dep karchive)
+		$(add_frameworks_dep kcompletion)
+		$(add_frameworks_dep kconfig)
+		$(add_frameworks_dep kconfigwidgets)
+		$(add_frameworks_dep kcoreaddons)
+		$(add_frameworks_dep kdelibs4support)
+		$(add_frameworks_dep kguiaddons)
+		$(add_frameworks_dep ki18n)
+		$(add_frameworks_dep kiconthemes)
+		$(add_frameworks_dep kio)
+		$(add_frameworks_dep kwidgetsaddons)
+		$(add_frameworks_dep kwindowsystem)
+		$(add_frameworks_dep kxmlgui)
+		$(add_qt_dep qtprintsupport)
+	)
+	X? (
+		x11-libs/libX11
+		x11-libs/libxcb
+	)
+"
+DEPEND="${COMMON_DEPEND}
+	virtual/pkgconfig
+	nls? ( sys-devel/gettext )
+"
+RDEPEND="${COMMON_DEPEND}
+	!x11-themes/gtk-engines-qtcurve
+"
+
+DOCS=( AUTHORS ChangeLog.md README.md TODO.md )
+
+PATCHES=(
+	"${FILESDIR}/${PN}-1.9.0-rare_crash_hang_fix.patch"
+)
+
+src_configure() {
+	local mycmakeargs=(
+		-DLIB_INSTALL_DIR="$(get_libdir)"
+		-DQTC_QT4_ENABLE_KDE=OFF
+		-DQTC_QT4_ENABLE_KWIN=OFF
+		-DQTC_KDE4_DEFAULT_HOME=ON
+		-DENABLE_GTK2="$(usex gtk)"
+		-DENABLE_QT4="$(usex qt4)"
+		-DENABLE_QT5="$(usex qt5)"
+		-DENABLE_TEST="$(usex test)"
+		-DQTC_ENABLE_X11="$(usex X)"
+		-DQTC_INSTALL_PO="$(usex nls)"
+		-DQTC_QT5_ENABLE_KDE="$(usex plasma)"
+	)
+
+	kde5_src_configure
+}