[packages/kde4-kdebase-runtime] - rel 2; fixes kwallet access hangs - upstream bug 254198

arekm arekm at pld-linux.org
Sun Sep 1 22:52:46 CEST 2013


commit 41f98221f8bcebc91d0a63e9d907ee577ba1395b
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sun Sep 1 22:52:34 2013 +0200

    - rel 2; fixes kwallet access hangs - upstream bug 254198

 kde4-kdebase-runtime.spec        |   4 +-
 kdebase-runtime-bug-254198.patch | 308 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 311 insertions(+), 1 deletion(-)
---
diff --git a/kde4-kdebase-runtime.spec b/kde4-kdebase-runtime.spec
index 9fe55ca..0db82c1 100644
--- a/kde4-kdebase-runtime.spec
+++ b/kde4-kdebase-runtime.spec
@@ -13,7 +13,7 @@ Summary:	KDE 4 base runtime components
 Summary(pl.UTF-8):	Komponenty uruchomieniowe podstawowej części KDE 4
 Name:		kde4-kdebase-runtime
 Version:	4.11.0
-Release:	1
+Release:	2
 License:	GPL
 Group:		X11/Applications
 Source0:	ftp://ftp.kde.org/pub/kde/%{_state}/%{version}/src/%{orgname}-%{version}.tar.xz
@@ -24,6 +24,7 @@ Source2:	l10n-iso639-1
 # Source3-md5:	5e8154256c2941b74ed17b0bf18c753d
 Patch100:	%{name}-branch.diff
 Patch0:		%{name}-rpc.patch
+Patch1:		kdebase-runtime-bug-254198.patch
 URL:		http://www.kde.org/
 BuildRequires:	OpenEXR-devel
 BuildRequires:	alsa-lib-devel
@@ -100,6 +101,7 @@ Wtyczki KDE 4 dla Phonona.
 %setup -q -n %{orgname}-%{version} -a1
 #%patch100 -p1
 %patch0 -p1
+%patch1 -p1
 
 %build
 install -d build
diff --git a/kdebase-runtime-bug-254198.patch b/kdebase-runtime-bug-254198.patch
new file mode 100644
index 0000000..48e69ee
--- /dev/null
+++ b/kdebase-runtime-bug-254198.patch
@@ -0,0 +1,308 @@
+From: Valentin Rusu <kde at rusu.info>
+Date: Sat, 31 Aug 2013 23:28:09 +0000
+Subject: Fix the synchronous-mode wallet open logic
+X-Git-Url: http://quickgit.kde.org/?p=kde-runtime.git&a=commitdiff&h=b0f9053ed8abff4ef973b10842f761422ee17f41
+---
+Fix the synchronous-mode wallet open logic
+
+BUG: 254198
+
+The wallet synchronous open requests now use qdbus delayed replies.
+The execution path now returns to the main event loop instead of
+a nested event loop. The wallet opening UI logic is correctly handled
+no longer leading to a frozen kwalletd.
+
+Beware that this commit should be used along with the corresponding
+fix of the kdelibs/kdeui module. Failing to updating kdelibs lead to
+an aparently similar freeze condition, as kdeui also used an internal
+event loop, faking synchronous operation when making async kwalletd calls.
+---
+
+
+--- a/kwalletd/CMakeLists.txt
++++ b/kwalletd/CMakeLists.txt
+@@ -12,7 +12,6 @@
+    main.cpp
+    kbetterthankdialog.cpp
+    kwalletd.cpp
+-   kwalletopenloop.cpp
+    kwalletwizard.cpp
+    ktimeout.cpp
+    kwalletsessionstore.cpp
+
+--- a/kwalletd/kwalletd.cpp
++++ b/kwalletd/kwalletd.cpp
+@@ -55,13 +55,12 @@
+ #include <assert.h>
+ 
+ #include "kwalletadaptor.h"
+-#include "kwalletopenloop.h"
+ 
+ class KWalletTransaction {
+ 
+     public:
+-        KWalletTransaction()
+-            : tType(Unknown), cancelled(false), tId(nextTransactionId)
++        explicit KWalletTransaction(QDBusConnection conn)
++            : tType(Unknown), cancelled(false), tId(nextTransactionId), res(-1), connection(conn)
+         {
+             nextTransactionId++;
+             // make sure the id is never < 0 as that's used for the
+@@ -90,6 +89,9 @@
+         bool modal;
+         bool isPath;
+         int tId; // transaction id
++        int res;
++        QDBusMessage message;
++        QDBusConnection connection;
+ 
+     private:
+         static int nextTransactionId;
+@@ -198,7 +200,7 @@
+ 				} else if (_curtrans->cancelled) {
+ 					// the wallet opened successfully but the application
+ 					// opening exited/crashed while the dialog was still shown.
+-					KWalletTransaction *_xact = new KWalletTransaction();
++					KWalletTransaction *_xact = new KWalletTransaction(_curtrans->connection);
+ 					_xact->tType = KWalletTransaction::CloseCancelled;
+ 					_xact->appid = _curtrans->appid;
+ 					_xact->wallet = _curtrans->wallet;
+@@ -207,11 +209,13 @@
+ 				}
+ 
+ 				// emit the AsyncOpened signal as a reply
++				_curtrans->res = res;
+ 				emit walletAsyncOpened(_curtrans->tId, res);
+ 				break;
+ 
+ 			case KWalletTransaction::OpenFail:
+ 				// emit the AsyncOpened signal with an invalid handle
++                _curtrans->res = -1;
+ 				emit walletAsyncOpened(_curtrans->tId, -1);
+ 				break;
+ 
+@@ -230,14 +234,21 @@
+ 				break;
+ 		}
+ 
++		// send delayed dbus message reply to the caller
++		if (_curtrans->message.type() != QDBusMessage::InvalidMessage) {
++            if (_curtrans->connection.isConnected()) {
++                QDBusMessage reply = _curtrans->message.createReply();
++                reply << _curtrans->res;
++                _curtrans->connection.send(reply);
++            }
++        }
++
+ 		delete _curtrans;
+ 		_curtrans = 0;
+ 	}
+ 
+ 	_processing = false;
+ }
+-
+-
+ 
+ int KWalletD::openPath(const QString& path, qlonglong wId, const QString& appid) {
+ 	int tId = openPathAsync(path, wId, appid, false);
+@@ -245,20 +256,39 @@
+ 		return tId;
+ 	}
+ 
++	// NOTE the real return value will be sent by the dbusmessage delayed reply
++	return 0;
+ 	// wait for the open-transaction to be processed
+-	KWalletOpenLoop loop(this);
+-	return loop.waitForAsyncOpen(tId);
++// 	KWalletOpenLoop loop(this);
++// 	return loop.waitForAsyncOpen(tId);
+ }
+ 
+ int KWalletD::open(const QString& wallet, qlonglong wId, const QString& appid) {
+-	int tId = openAsync(wallet, wId, appid, false);
+-	if (tId < 0) {
+-		return tId;
+-	}
+-
+-	// wait for the open-transaction to be processed
+-	KWalletOpenLoop loop(this);
+-	return loop.waitForAsyncOpen(tId);
++    if (!_enabled) { // guard
++        return -1;
++    }
++
++    if (!QRegExp("^[\\w\\^\\&\\'\\@\\{\\}\\[\\]\\,\\$\\=\\!\\-\\#\\(\\)\\%\\.\\+\\_\\s]+$").exactMatch(wallet)) {
++        return -1;
++    }
++
++    KWalletTransaction *xact = new KWalletTransaction(connection());
++    _transactions.append(xact);
++
++    message().setDelayedReply(true);
++    xact->message = message();
++
++    xact->appid = appid;
++    xact->wallet = wallet;
++    xact->wId = wId;
++    xact->modal = true; // mark dialogs as modal, the app has blocking wait
++    xact->tType = KWalletTransaction::Open;
++    xact->isPath = false;
++
++    QTimer::singleShot(0, this, SLOT(processTransactions()));
++    checkActiveDialog();
++    // NOTE the real return value will be sent by the dbusmessage delayed reply
++    return 0;
+ }
+ 
+ int KWalletD::openAsync(const QString& wallet, qlonglong wId, const QString& appid,
+@@ -271,8 +301,8 @@
+ 		return -1;
+ 	}
+ 
+-	KWalletTransaction *xact = new KWalletTransaction;
+-	_transactions.append(xact);
++	KWalletTransaction *xact = new KWalletTransaction(connection());
++    _transactions.append(xact);
+ 
+ 	xact->appid = appid;
+ 	xact->wallet = wallet;
+@@ -298,8 +328,8 @@
+ 		return -1;
+ 	}
+ 
+-	KWalletTransaction *xact = new KWalletTransaction;
+-	_transactions.append(xact);
++    KWalletTransaction *xact = new KWalletTransaction(connection());
++    _transactions.append(xact);
+ 
+ 	xact->appid = appid;
+ 	xact->wallet = path;
+@@ -674,9 +704,11 @@
+ 
+ 
+ void KWalletD::changePassword(const QString& wallet, qlonglong wId, const QString& appid) {
+-	KWalletTransaction *xact = new KWalletTransaction;
+-
+-	//msg.setDelayedReply(true);
++	KWalletTransaction *xact = new KWalletTransaction(connection());
++
++    message().setDelayedReply(true);
++    xact->message = message();
++
+ 	xact->appid = appid;
+ 	xact->wallet = wallet;
+ 	xact->wId = wId;
+
+--- a/kwalletd/kwalletopenloop.cpp
++++ /dev/null
+@@ -1,46 +0,0 @@
+-// -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
+-/*
+-   This file is part of the KDE libraries
+-
+-   Copyright (c) 2008 Michael Leupold <lemma at confuego.org>
+-
+-   This library is free software; you can redistribute it and/or
+-   modify it under the terms of the GNU Library General Public
+-   License as published by the Free Software Foundation; either
+-   version 2 of the License, or (at your option) any later version.
+-
+-   This library is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+-   Library General Public License for more details.
+-
+-   You should have received a copy of the GNU Library General Public License
+-   along with this library; see the file COPYING.LIB.  If not, write to
+-   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+-   Boston, MA 02110-1301, USA.
+-
+-*/
+-
+-#include "kwalletopenloop.h"
+-#include "kwalletd.h"
+-
+-int KWalletOpenLoop::waitForAsyncOpen(int tId)
+-{
+-	transaction = tId;
+-	connect(wallet, SIGNAL(walletAsyncOpened(int, int)),
+-                    SLOT(walletAsyncOpened(int, int)));
+-	exec();
+-	disconnect(this, SLOT(walletAsyncOpened(int, int)));
+-	return result;
+-}
+-
+-void KWalletOpenLoop::walletAsyncOpened(int tId, int handle)
+-{
+-	// if our transaction finished, stop waiting
+-	if (tId == transaction) {
+-		result = handle;
+-		quit();
+-	}
+-}
+-
+-#include "kwalletopenloop.moc"
+--- a/kwalletd/kwalletopenloop.h
++++ /dev/null
+@@ -1,50 +0,0 @@
+-// -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
+-/*
+-   This file is part of the KDE libraries
+-
+-   Copyright (c) 2008 Michael Leupold <lemma at confuego.org>
+-
+-   This library is free software; you can redistribute it and/or
+-   modify it under the terms of the GNU Library General Public
+-   License as published by the Free Software Foundation; either
+-   version 2 of the License, or (at your option) any later version.
+-
+-   This library is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+-   Library General Public License for more details.
+-
+-   You should have received a copy of the GNU Library General Public License
+-   along with this library; see the file COPYING.LIB.  If not, write to
+-   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+-   Boston, MA 02110-1301, USA.
+-
+-*/
+-
+-#ifndef KWALLETOPENLOOP_H
+-#define KWALLETOPENLOOP_H
+-
+-#include <QtCore/QEventLoop>
+-
+-class KWalletD;
+-
+-class KWalletOpenLoop : public QEventLoop {
+-	Q_OBJECT
+-	
+-	public:
+-		explicit KWalletOpenLoop(KWalletD* w, QObject* parent = 0)
+-		    : QEventLoop(parent), wallet(w) {}
+-		
+-		// returns the open handle
+-		int waitForAsyncOpen(int tId);
+-		
+-	public slots:
+-		void walletAsyncOpened(int tId, int handle);
+-		
+-	private:
+-		KWalletD* wallet;
+-		int transaction;
+-		int result;
+-};
+-
+-#endif
+--- a/kwalletd/main.cpp
++++ b/kwalletd/main.cpp
+@@ -65,6 +65,7 @@
+       return (0);
+     }
+ 
++    kDebug() << "kwalletd started";
+     KWalletD walletd;
+     return app.exec();
+ }
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kde4-kdebase-runtime.git/commitdiff/41f98221f8bcebc91d0a63e9d907ee577ba1395b



More information about the pld-cvs-commit mailing list