diff options
author | Søren Sandmann Pedersen <sandmann@daimi.au.dk> | 2006-05-12 21:53:28 +0000 |
---|---|---|
committer | Søren Sandmann Pedersen <sandmann@daimi.au.dk> | 2006-05-12 21:53:28 +0000 |
commit | 6558ba4e62dba99f2a4d830f1c16f8d1c255b316 (patch) | |
tree | 9638b48625b2c55cc6ec6b8dbbaa907734d63450 | |
parent | 9e239a0df7ededb50de091e5271cbfddd2b683c3 (diff) |
Fri May 12 17:51:26 2006 Søren Sandmann <sandmann@redhat.com>
Keep track of the previous item and update its next pointer when deleting
from the linked list.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Xext/sync.c | 17 |
2 files changed, 20 insertions, 3 deletions
@@ -1,3 +1,9 @@ +Fri May 12 17:51:26 2006 Søren Sandmann <sandmann@redhat.com> + + * Xext/sync.c (SyncDeleteTriggerFromCounter): Keep track of the + previous item and update its next pointer when deleting from the + linked list. + 2006-05-11 Matthias Hopf <mhopf@suse.de> * fb/fbpict.c: (fbComposite): diff --git a/Xext/sync.c b/Xext/sync.c index c88d81c36..e1383cea3 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -302,22 +302,33 @@ SyncDeleteTriggerFromCounter(pTrigger) SyncTrigger *pTrigger; { SyncTriggerList *pCur; + SyncTriggerList *pPrev; /* pCounter needs to be stored in pTrigger before calling here. */ if (!pTrigger->pCounter) return; - for (pCur = pTrigger->pCounter->pTriglist; pCur; pCur = pCur->next) + pPrev = NULL; + pCur = pTrigger->pCounter->pTriglist; + + while (pCur) { if (pCur->pTrigger == pTrigger) { - pTrigger->pCounter->pTriglist = pCur->next; + if (pPrev) + pPrev->next = pCur->next; + else + pTrigger->pCounter->pTriglist = pCur->next; + xfree(pCur); break; } + + pPrev = pCur; + pCur = pCur->next; } - + if (IsSystemCounter(pTrigger->pCounter)) SyncComputeBracketValues(pTrigger->pCounter, /*startOver*/ TRUE); } |