Sync: Always initialise system counter list

Sync is designed to let you add system counters before the extension has
been initialised, which means the system counter list may well be full
of bees.  Make sure it's initialised before we add to it, to avoid the
risk of fatal injury.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Daniel Stone 2012-07-10 09:10:21 +01:00 committed by Keith Packard
parent 34cf559bcf
commit f937c3d501

View File

@ -951,6 +951,7 @@ SyncCreateSystemCounter(const char *name,
if (RTCounter == 0) { if (RTCounter == 0) {
return NULL; return NULL;
} }
xorg_list_init(&SysCounterList);
} }
pCounter = SyncCreateCounter(NULL, FakeClientID(0), initial); pCounter = SyncCreateCounter(NULL, FakeClientID(0), initial);
@ -2448,13 +2449,12 @@ SyncExtensionInit(void)
ExtensionEntry *extEntry; ExtensionEntry *extEntry;
int s; int s;
xorg_list_init(&SysCounterList);
for (s = 0; s < screenInfo.numScreens; s++) for (s = 0; s < screenInfo.numScreens; s++)
miSyncSetup(screenInfo.screens[s]); miSyncSetup(screenInfo.screens[s]);
if (RTCounter == 0) { if (RTCounter == 0) {
RTCounter = CreateNewResourceType(FreeCounter, "SyncCounter"); RTCounter = CreateNewResourceType(FreeCounter, "SyncCounter");
xorg_list_init(&SysCounterList);
} }
RTAlarm = CreateNewResourceType(FreeAlarm, "SyncAlarm"); RTAlarm = CreateNewResourceType(FreeAlarm, "SyncAlarm");
RTAwait = CreateNewResourceType(FreeAwait, "SyncAwait"); RTAwait = CreateNewResourceType(FreeAwait, "SyncAwait");