diff -u -r dbus-1.8.20/dbus/dbus-connection.c dbus-1.8.20-patch/dbus/dbus-connection.c --- dbus-1.8.20/dbus/dbus-connection.c 2015-05-14 13:23:25.000000000 +0100 +++ dbus-1.8.20-patch/dbus/dbus-connection.c 2017-09-18 11:27:57.510653542 +0100 @@ -325,6 +325,7 @@ unsigned int disconnected_message_processed : 1; /**< We did our default handling of the disconnected message, * such as closing the connection. */ + unsigned int processing : 1; /**< TRUE if dispatch processing is in progress */ #ifndef DBUS_DISABLE_CHECKS unsigned int have_connection_lock : 1; /**< Used to check locking */ @@ -1222,6 +1223,14 @@ { _dbus_verbose ("pending call completed while acquiring I/O path (reply found in queue)"); } + else if ( (pending != NULL) && (_dbus_pending_call_get_processing_unlocked(pending)) ) + { + _dbus_verbose ("pending call processing while acquiring I/O path"); + } + else if ( connection->processing ) + { + _dbus_verbose ("connection processing while acquiring I/O path"); + } else { _dbus_transport_do_iteration (connection->transport, @@ -2525,7 +2534,7 @@ { /* block again, we don't have the reply buffered yet. */ _dbus_connection_do_iteration_unlocked (connection, - NULL, + pending, DBUS_ITERATION_DO_READING | DBUS_ITERATION_BLOCK, timeout_milliseconds - elapsed_milliseconds); @@ -4622,11 +4631,14 @@ reply_serial); if (pending) { + connection->processing = 1; + _dbus_pending_call_processing(pending); _dbus_verbose ("Dispatching a pending reply\n"); complete_pending_call_and_unlock (connection, pending, message); pending = NULL; /* it's probably unref'd */ CONNECTION_LOCK (connection); + connection->processing = 0; _dbus_verbose ("pending call completed in dispatch\n"); result = DBUS_HANDLER_RESULT_HANDLED; goto out; diff -u -r dbus-1.8.20/dbus/dbus-pending-call.c dbus-1.8.20-patch/dbus/dbus-pending-call.c --- dbus-1.8.20/dbus/dbus-pending-call.c 2015-05-14 13:23:04.000000000 +0100 +++ dbus-1.8.20-patch/dbus/dbus-pending-call.c 2017-09-18 13:01:36.453913127 +0100 @@ -77,6 +77,7 @@ unsigned int completed : 1; /**< TRUE if completed */ unsigned int timeout_added : 1; /**< Have added the timeout */ + unsigned int processing : 1; /**< Processing has started */ }; static void @@ -194,6 +195,20 @@ } /** + * Marks the call as having started processing. + * + * @param pending the pending call + * + */ +void +_dbus_pending_call_processing (DBusPendingCall *pending) +{ + _dbus_assert (!pending->processing); + + pending->processing = TRUE; +} + +/** * Calls notifier function for the pending call * and sets the call to completed. * @@ -482,6 +497,19 @@ return pending->completed; } +/** + * Checks whether the pending call has started processing + * yet, or not. Assumes connection lock is held. + * + * @param pending the pending call + * @returns #TRUE if the pending call has started processing + */ +dbus_bool_t +_dbus_pending_call_get_processing_unlocked (DBusPendingCall *pending) +{ + return pending->processing; +} + static DBusDataSlotAllocator slot_allocator = _DBUS_DATA_SLOT_ALLOCATOR_INIT (_DBUS_LOCK_NAME (pending_call_slots)); diff -u -r dbus-1.8.20/dbus/dbus-pending-call-internal.h dbus-1.8.20-patch/dbus/dbus-pending-call-internal.h --- dbus-1.8.20/dbus/dbus-pending-call-internal.h 2015-05-14 13:23:25.000000000 +0100 +++ dbus-1.8.20-patch/dbus/dbus-pending-call-internal.h 2017-09-18 10:26:10.230037445 +0100 @@ -41,7 +41,9 @@ DBusConnection * _dbus_pending_call_get_connection_and_lock (DBusPendingCall *pending); DBusConnection * _dbus_pending_call_get_connection_unlocked (DBusPendingCall *pending); dbus_bool_t _dbus_pending_call_get_completed_unlocked (DBusPendingCall *pending); +dbus_bool_t _dbus_pending_call_get_processing_unlocked (DBusPendingCall *pending); void _dbus_pending_call_complete (DBusPendingCall *pending); +void _dbus_pending_call_processing (DBusPendingCall *pending); void _dbus_pending_call_set_reply_unlocked (DBusPendingCall *pending, DBusMessage *message); void _dbus_pending_call_queue_timeout_error_unlocked (DBusPendingCall *pending,