g_return_val_if_fail (obj != NULL, NULL);
reply = _atspi_dbus_call_partial (obj, atspi_interface_accessible, "GetRelationSet", error, "");
- _ATSPI_DBUS_CHECK_SIG (reply, "a(ua(so))", NULL);
+ if (!reply)
+ return NULL;
+ _ATSPI_DBUS_CHECK_SIG (reply, "a(ua(so))", error, NULL);
ret = g_array_new (TRUE, TRUE, sizeof (AtspiRelation *));
dbus_message_iter_init (reply, &iter);
return retval;
}
+static AtspiStateSet *
+defunct_set ()
+{
+ AtspiStateSet *set = atspi_state_set_new (NULL);
+ atspi_state_set_add (set, ATSPI_STATE_DEFUNCT);
+ return set;
+}
+
/**
* atspi_accessible_get_state_set:
* @obj: a pointer to the #AtspiAccessible object on which to operate.
atspi_accessible_get_state_set (AtspiAccessible *obj)
{
if (!obj->parent.app || !obj->parent.app->bus)
- {
- AtspiStateSet *set = atspi_state_set_new (NULL);
- atspi_state_set_add (set, ATSPI_STATE_DEFUNCT);
- return set;
- }
+ return defunct_set ();
if (!(obj->cached_properties & ATSPI_CACHE_STATES))
DBusMessageIter iter;
reply = _atspi_dbus_call_partial (obj, atspi_interface_accessible,
"GetState", NULL, "");
- _ATSPI_DBUS_CHECK_SIG (reply, "au", NULL);
+ _ATSPI_DBUS_CHECK_SIG (reply, "au", NULL, defunct_set ());
dbus_message_iter_init (reply, &iter);
_atspi_dbus_set_state (obj, &iter);
dbus_message_unref (reply);
DBusMessageIter iter;
reply = _atspi_dbus_call_partial (accessible, atspi_interface_accessible,
"GetInterfaces", NULL, "");
- _ATSPI_DBUS_CHECK_SIG (reply, "as", FALSE);
+ _ATSPI_DBUS_CHECK_SIG (reply, "as", NULL, FALSE);
dbus_message_iter_init (reply, &iter);
_atspi_dbus_set_interfaces (accessible, &iter);
dbus_message_unref (reply);
DBusMessageIter iter, iter_array;
GArray *ret = g_array_new (TRUE, TRUE, sizeof (AtspiAccessible *));
- _ATSPI_DBUS_CHECK_SIG (message, "a(so)", NULL);
+ _ATSPI_DBUS_CHECK_SIG (message, "a(so)", NULL, NULL);
dbus_message_iter_init (message, &iter);
dbus_message_iter_recurse (&iter, &iter_array);
void _atspi_dbus_set_state (AtspiAccessible *accessible, DBusMessageIter *iter);
-#define _ATSPI_DBUS_CHECK_SIG(message, type, ret) \
+#define _ATSPI_DBUS_CHECK_SIG(message, type, error, ret) \
if (!message) { \
g_warning ("at-spi: Got no message at %s line %d\n", __FILE__, __LINE__); \
return (ret); \
} \
+ if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR) \
+ { \
+ const char *err; \
+ dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID); \
+ if (err) \
+ g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, err); \
+ dbus_message_unref (message); \
+ return ret; \
+ } \
if (strcmp (dbus_message_get_signature (message), type) != 0) \
{ \
g_warning ("at-spi: Expected message signature %s but got %s at %s line %d", type, dbus_message_get_signature (message), __FILE__, __LINE__); \
*/
typedef enum
{
- ATSPI_ERROR_APPLICATION_GONE
+ ATSPI_ERROR_APPLICATION_GONE,
+ ATSPI_ERROR_IPC
} AtspiError;
#endif /* _ATSPI_MISC_PRIVATE_H_ */
DBusMessageIter iter;
GHashTable *ret;
- _ATSPI_DBUS_CHECK_SIG (message, "a{ss}", NULL);
+ if (!message)
+ return NULL;
+
+ _ATSPI_DBUS_CHECK_SIG (message, "a{ss}", NULL, NULL);
dbus_message_iter_init (message, &iter);
ret = _atspi_dbus_hash_from_iter (&iter);
DBusMessageIter iter;
GArray *ret;
- _ATSPI_DBUS_CHECK_SIG (message, "a{ss}", NULL);
+ if (!message)
+ return NULL;
+
+ _ATSPI_DBUS_CHECK_SIG (message, "a{ss}", NULL, NULL);
dbus_message_iter_init (message, &iter);
return NULL;
reply = _atspi_dbus_call_partial (obj, atspi_interface_text, "GetAttributes", error, "i", d_offset);
- _ATSPI_DBUS_CHECK_SIG (reply, "a{ss}ii", ret)
+ _ATSPI_DBUS_CHECK_SIG (reply, "a{ss}ii", error, ret)
dbus_message_iter_init (reply, &iter);
ret = _atspi_dbus_hash_from_iter (&iter);
reply = _atspi_dbus_call_partial (obj, atspi_interface_text,
"GetAttributeRun", error, "ib", d_offset,
include_defaults);
- _ATSPI_DBUS_CHECK_SIG (reply, "a{ss}ii", ret)
+ _ATSPI_DBUS_CHECK_SIG (reply, "a{ss}ii", error, ret)
dbus_message_iter_init (reply, &iter);
ret = _atspi_dbus_hash_from_iter (&iter);