summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tqdbusconnection.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/tqdbusconnection.cpp b/tqdbusconnection.cpp
index d4449d7..eb2edd5 100644
--- a/tqdbusconnection.cpp
+++ b/tqdbusconnection.cpp
@@ -29,6 +29,8 @@
#include "tqdbusmessage.h"
#include "tqdbusconnection_p.h"
+#include "tqdbusmessage_p.h"
+
QT_STATIC_CONST_IMPL char *TQT_DBusConnection::default_connection_name = "qt_dbus_default_connection";
class TQT_DBusConnectionManager
@@ -280,12 +282,23 @@ TQT_DBusMessage TQT_DBusConnection::sendWithReply(const TQT_DBusMessage &message
return TQT_DBusMessage::fromDBusMessage(0);
DBusMessage *reply = dbus_connection_send_with_reply_and_block(d->connection, msg,
-1, &d->error);
+
if (d->handleError() && error)
*error = d->lastError;
dbus_message_unref(msg);
- return TQT_DBusMessage::fromDBusMessage(reply);
+ TQT_DBusMessage ret = TQT_DBusMessage::fromDBusMessage(reply);
+
+ // HACK
+ // Reset the error object if no error was reported by DBus
+ // This is needed because TQT_DBusMessage::fromDBusMessage sometimes sets the error object even if DBus did not report a fatal error,
+ // and the dbus_error_is_set() check cannot be moved inside fromDBusMessage() without breaking the API and ABI.
+ if (!dbus_error_is_set(&d->error)) {
+ ret.d->error = TQT_DBusError();
+ }
+
+ return ret;
}
void TQT_DBusConnection::flush() const