[PATCH 2/2] mi: Log an error if mieqProcessInputEvents() recurses.
Keith Packard
keithp at keithp.com
Wed Jun 20 11:52:34 PDT 2012
From: Andy Ritger <aritger at nvidia.com>
v2:
Uses BUG_WARN_MSG to also provide a stack trace. (Peter Hutterer)
Signed-off-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Andy Ritger <aritger at nvidia.com>
---
mi/mieq.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/mi/mieq.c b/mi/mieq.c
index c7dd0ad..01f74ac 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -572,11 +572,20 @@ mieqProcessInputEvents(void)
InternalEvent event;
DeviceIntPtr dev = NULL, master = NULL;
size_t n_enqueued;
+ static Bool inProcessInputEvents = FALSE;
#ifdef XQUARTZ
pthread_mutex_lock(&miEventQueueMutex);
#endif
+ /*
+ * report an error if mieqProcessInputEvents() is called recursively;
+ * this can happen, e.g., if something in the mieqProcessDeviceEvent()
+ * call chain calls UpdateCurrentTime() instead of UpdateCurrentTimeIf()
+ */
+ BUG_WARN_MSG(inProcessInputEvents, "[mi] mieqProcessInputEvents() called recursively.\n");
+ inProcessInputEvents = TRUE;
+
/* Grow our queue if we are reaching capacity: < 2 * QUEUE_RESERVED_SIZE remaining */
n_enqueued = mieqNumEnqueued(&miEventQueue);
if (n_enqueued >= (miEventQueue.nevents - (2 * QUEUE_RESERVED_SIZE)) &&
@@ -631,6 +640,9 @@ mieqProcessInputEvents(void)
pthread_mutex_lock(&miEventQueueMutex);
#endif
}
+
+ inProcessInputEvents = FALSE;
+
#ifdef XQUARTZ
pthread_mutex_unlock(&miEventQueueMutex);
#endif
--
1.7.10
More information about the xorg-devel
mailing list