summaryrefslogtreecommitdiff
path: root/Xext
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <sandmann@daimi.au.dk>2006-05-12 21:53:28 +0000
committerSøren Sandmann Pedersen <sandmann@daimi.au.dk>2006-05-12 21:53:28 +0000
commit6558ba4e62dba99f2a4d830f1c16f8d1c255b316 (patch)
tree9638b48625b2c55cc6ec6b8dbbaa907734d63450 /Xext
parent9e239a0df7ededb50de091e5271cbfddd2b683c3 (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.
Diffstat (limited to 'Xext')
-rw-r--r--Xext/sync.c17
1 files changed, 14 insertions, 3 deletions
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);
}