summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2009-09-17 18:14:31 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2009-09-20 20:45:24 +1000
commit8b5086250aa5dae8de8b763408ff480d7beac819 (patch)
tree781d7cac5662704a19c528dc590629c5382908b5 /mi
parentc7987660fd665f32406b14db7078a3f5f7b76e9c (diff)
Eliminate bogus event resizing.
Now that all event queues hold internal events only, they never need to be resized. Resizing them led to memory corruption as they would get sized for an appropriate xEvent, not an internal event. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'mi')
-rw-r--r--mi/mi.h4
-rw-r--r--mi/mieq.c21
2 files changed, 14 insertions, 11 deletions
diff --git a/mi/mi.h b/mi/mi.h
index 3db8bfcf1..812edce94 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -196,9 +196,7 @@ extern _X_EXPORT Bool mieqInit(
void
);
-extern _X_EXPORT void mieqResizeEvents(
- int /* min_size */
-);
+extern _X_EXPORT void mieqFini(void);
extern _X_EXPORT void mieqEnqueue(
DeviceIntPtr /*pDev*/,
diff --git a/mi/mieq.c b/mi/mieq.c
index 1b81e4d99..0b6488203 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -110,24 +110,29 @@ mieqInit(void)
miEventQueue.handlers[i] = NULL;
for (i = 0; i < QUEUE_SIZE; i++)
{
- EventListPtr evlist = InitEventList(1);
- if (!evlist)
- FatalError("Could not allocate event queue.\n");
- miEventQueue.events[i].events = evlist;
+ if (miEventQueue.events[i].events == NULL) {
+ EventListPtr evlist = InitEventList(1);
+ if (!evlist)
+ FatalError("Could not allocate event queue.\n");
+ miEventQueue.events[i].events = evlist;
+ }
}
SetInputCheck(&miEventQueue.head, &miEventQueue.tail);
return TRUE;
}
-/* Ensure all events in the EQ are at least size bytes. */
void
-mieqResizeEvents(int min_size)
+mieqFini(void)
{
int i;
-
for (i = 0; i < QUEUE_SIZE; i++)
- SetMinimumEventSize(miEventQueue.events[i].events, 1, min_size);
+ {
+ if (miEventQueue.events[i].events != NULL) {
+ FreeEventList(miEventQueue.events[i].events, 1);
+ miEventQueue.events[i].events = NULL;
+ }
+ }
}
/*