summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-26 10:46:39 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-26 10:46:39 -0600
commit76bf393f73c8c7784720b4293ca0abb5e96d30ae (patch)
treef9f64d43ebfc023d384d7b89082dbd9334d5f80b
parentc34905edc35248c9b977593c569aeaab5940ae93 (diff)
downloaddbus-1-tqt-76bf393f73c8c7784720b4293ca0abb5e96d30ae.tar.gz
dbus-1-tqt-76bf393f73c8c7784720b4293ca0abb5e96d30ae.zip
Fix intermittent incorrectly set error object on successful dbus call
-rw-r--r--tqdbusconnection.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/tqdbusconnection.cpp b/tqdbusconnection.cpp
index a755610..d185e36 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