parent
8fdc212c18
commit
e5ae2081a9
@ -0,0 +1,79 @@
|
|||||||
|
From da41de0e4a98eed232eb05a14e903666dbb21838 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Nicoletti <dantti12@gmail.com>
|
||||||
|
Date: Thu, 7 Mar 2013 00:40:13 -0300
|
||||||
|
Subject: [PATCH 5/5] Make sure we set an error if we fail to contact
|
||||||
|
PackageKit Fixes KDE Bug: 315009
|
||||||
|
|
||||||
|
---
|
||||||
|
src/transaction.cpp | 35 ++++++++++++++++++-----------------
|
||||||
|
1 file changed, 18 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/transaction.cpp b/src/transaction.cpp
|
||||||
|
index 47b3c56..41884a7 100644
|
||||||
|
--- a/src/transaction.cpp
|
||||||
|
+++ b/src/transaction.cpp
|
||||||
|
@@ -67,19 +67,19 @@ bool Transaction::init(const QDBusObjectPath &tid)
|
||||||
|
// he want us to get it
|
||||||
|
if (tid.path().isNull()) {
|
||||||
|
d->tid = Daemon::global()->getTid();
|
||||||
|
+ if (d->tid.path().isEmpty()) {
|
||||||
|
+ d->error = Transaction::InternalErrorDaemonUnreachable;
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
} else {
|
||||||
|
d->tid = tid;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (d->tid.path().isEmpty()) {
|
||||||
|
- d->error = Transaction::InternalErrorDaemonUnreachable;
|
||||||
|
- return false;
|
||||||
|
- } else {
|
||||||
|
-
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
int retry = 0;
|
||||||
|
do {
|
||||||
|
+ if (d->p) {
|
||||||
|
+ delete d->p;
|
||||||
|
+ }
|
||||||
|
d->p = new TransactionProxy(QLatin1String(PK_NAME),
|
||||||
|
d->tid.path(),
|
||||||
|
QDBusConnection::systemBus(),
|
||||||
|
@@ -95,23 +95,24 @@ bool Transaction::init(const QDBusObjectPath &tid)
|
||||||
|
message << qVariantFromValue(0U);
|
||||||
|
QDBusConnection::sessionBus().call(message, QDBus::BlockWithGui);
|
||||||
|
|
||||||
|
- // The transaction was not created
|
||||||
|
- delete d->p;
|
||||||
|
- d->p = 0;
|
||||||
|
retry++;
|
||||||
|
} else {
|
||||||
|
retry = 0;
|
||||||
|
}
|
||||||
|
} while (retry == 1);
|
||||||
|
|
||||||
|
- // if the transaction proxy was not created return false
|
||||||
|
- if (!d->p) {
|
||||||
|
+ // if the transaction proxy was not created return false and set the error
|
||||||
|
+ if (!d->p->isValid()) {
|
||||||
|
+ // The transaction was not created
|
||||||
|
+ d->error = Transaction::InternalErrorCannotStartDaemon;
|
||||||
|
+ emit errorCode(Transaction::ErrorInternalError, d->p->lastError().message());
|
||||||
|
+ delete d->p;
|
||||||
|
return false;
|
||||||
|
- } else {
|
||||||
|
- d->error = Transaction::InternalErrorNone;
|
||||||
|
- if (!Daemon::global()->hints().isEmpty()) {
|
||||||
|
- setHints(Daemon::global()->hints());
|
||||||
|
- }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ d->error = Transaction::InternalErrorNone;
|
||||||
|
+ if (!Daemon::global()->hints().isEmpty()) {
|
||||||
|
+ setHints(Daemon::global()->hints());
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(d->p, SIGNAL(Changed()),
|
||||||
|
--
|
||||||
|
1.8.1.4
|
||||||
|
|
Loading…
Reference in new issue