mi: Log an error if mieqProcessInputEvents() recurses.

v2:

Uses BUG_WARN_MSG to also provide a stack trace. (Peter Hutterer)

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Andy Ritger <aritger@nvidia.com>
This commit is contained in:
Andy Ritger 2012-06-20 11:52:34 -07:00 committed by Adam Jackson
parent cc57ab4fc8
commit d2a6962474
1 changed files with 12 additions and 0 deletions

View File

@ -579,11 +579,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)) &&
@ -642,6 +651,9 @@ mieqProcessInputEvents(void)
pthread_mutex_lock(&miEventQueueMutex);
#endif
}
inProcessInputEvents = FALSE;
#ifdef XQUARTZ
pthread_mutex_unlock(&miEventQueueMutex);
#endif