summaryrefslogtreecommitdiff
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
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.
-rw-r--r--ChangeLog6
-rw-r--r--Xext/sync.c17
2 files changed, 20 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 54d36a7d7..d42326c2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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);
}