diff options
Diffstat (limited to 'xserver/miext')
-rw-r--r-- | xserver/miext/sync/misync.c | 27 | ||||
-rw-r--r-- | xserver/miext/sync/misync.h | 1 | ||||
-rw-r--r-- | xserver/miext/sync/misyncstr.h | 5 |
3 files changed, 20 insertions, 13 deletions
diff --git a/xserver/miext/sync/misync.c b/xserver/miext/sync/misync.c index 490fa0b17..0931803f6 100644 --- a/xserver/miext/sync/misync.c +++ b/xserver/miext/sync/misync.c @@ -101,24 +101,29 @@ miSyncInitFence(ScreenPtr pScreen, SyncFence * pFence, Bool initially_triggered) pFence->funcs = miSyncFenceFuncs; pScreenPriv->funcs.CreateFence(pScreen, pFence, initially_triggered); + + pFence->sync.initialized = TRUE; } void miSyncDestroyFence(SyncFence * pFence) { - ScreenPtr pScreen = pFence->pScreen; - SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen); - SyncTriggerList *ptl, *pNext; - pFence->sync.beingDestroyed = TRUE; - /* tell all the fence's triggers that the counter has been destroyed */ - for (ptl = pFence->sync.pTriglist; ptl; ptl = pNext) { - (*ptl->pTrigger->CounterDestroyed) (ptl->pTrigger); - pNext = ptl->next; - free(ptl); /* destroy the trigger list as we go */ - } - pScreenPriv->funcs.DestroyFence(pScreen, pFence); + if (pFence->sync.initialized) { + ScreenPtr pScreen = pFence->pScreen; + SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen); + SyncTriggerList *ptl, *pNext; + + /* tell all the fence's triggers that the counter has been destroyed */ + for (ptl = pFence->sync.pTriglist; ptl; ptl = pNext) { + (*ptl->pTrigger->CounterDestroyed) (ptl->pTrigger); + pNext = ptl->next; + free(ptl); /* destroy the trigger list as we go */ + } + + pScreenPriv->funcs.DestroyFence(pScreen, pFence); + } dixFreeObjectWithPrivates(pFence, PRIVATE_SYNC_FENCE); } diff --git a/xserver/miext/sync/misync.h b/xserver/miext/sync/misync.h index dc78c5fdb..f7082d5ea 100644 --- a/xserver/miext/sync/misync.h +++ b/xserver/miext/sync/misync.h @@ -28,6 +28,7 @@ #ifndef _MISYNC_H_ #define _MISYNC_H_ +typedef struct _SyncObject SyncObject; typedef struct _SyncFence SyncFence; typedef struct _SyncTrigger SyncTrigger; diff --git a/xserver/miext/sync/misyncstr.h b/xserver/miext/sync/misyncstr.h index 2eab2aa57..6f89714d6 100644 --- a/xserver/miext/sync/misyncstr.h +++ b/xserver/miext/sync/misyncstr.h @@ -38,13 +38,14 @@ #define SYNC_COUNTER 0 #define SYNC_FENCE 1 -typedef struct _SyncObject { +struct _SyncObject { ClientPtr client; /* Owning client. 0 for system counters */ struct _SyncTriggerList *pTriglist; /* list of triggers */ XID id; /* resource ID */ unsigned char type; /* SYNC_* */ + unsigned char initialized; /* FALSE if created but not initialized */ Bool beingDestroyed; /* in process of going away */ -} SyncObject; +}; typedef struct _SyncCounter { SyncObject sync; /* Common sync object data */ |