[PATCH 2/2] mi: Log an error if mieqProcessInputEvents() recurses.
Andy Ritger
aritger at nvidia.com
Thu Jun 14 09:15:38 PDT 2012
Also, remove the unnecessary static qualifier on mieqProcessInputEvents()'s
'event' local variable.
Signed-off-by: Andy Ritger <aritger at nvidia.com>
---
mi/mieq.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/mi/mieq.c b/mi/mieq.c
index e117a8d..8339afb 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -569,14 +569,25 @@ mieqProcessInputEvents(void)
{
EventRec *e = NULL;
ScreenPtr screen;
- static InternalEvent event;
+ 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()
+ */
+ if (inProcessInputEvents) {
+ ErrorF("[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 +642,9 @@ mieqProcessInputEvents(void)
pthread_mutex_lock(&miEventQueueMutex);
#endif
}
+
+ inProcessInputEvents = FALSE;
+
#ifdef XQUARTZ
pthread_mutex_unlock(&miEventQueueMutex);
#endif
--
1.7.7
More information about the xorg-devel
mailing list