aboutsummaryrefslogtreecommitdiff
path: root/src/rt/rust_task.cpp
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-07-12 13:11:58 -0700
committerGraydon Hoare <[email protected]>2010-07-12 13:26:28 -0700
commit7c837b8c9bd05d69083dd98f9a29d47d4a62c206 (patch)
tree9d2c3fa8fd8c60de84b395fab56e12bfa3308466 /src/rt/rust_task.cpp
parentAdd more tracing code to trans for refcount events. (diff)
downloadrust-7c837b8c9bd05d69083dd98f9a29d47d4a62c206.tar.xz
rust-7c837b8c9bd05d69083dd98f9a29d47d4a62c206.zip
Correct doubly-linked list management logic; bug exposed during conversation on issue #106.
Diffstat (limited to 'src/rt/rust_task.cpp')
-rw-r--r--src/rt/rust_task.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp
index 084c8acd..43213b46 100644
--- a/src/rt/rust_task.cpp
+++ b/src/rt/rust_task.cpp
@@ -423,6 +423,8 @@ rust_task::link_gc(gc_alloc *gcm) {
gcm->prev = NULL;
gcm->next = gc_alloc_chain;
gc_alloc_chain = gcm;
+ if (gcm->next)
+ gcm->next->prev = gcm;
}
void
@@ -431,6 +433,8 @@ rust_task::unlink_gc(gc_alloc *gcm) {
gcm->prev->next = gcm->next;
if (gcm->next)
gcm->next->prev = gcm->prev;
+ if (gc_alloc_chain == gcm)
+ gc_alloc_chain = gcm->next;
gcm->prev = NULL;
gcm->next = NULL;
}