summaryrefslogtreecommitdiff
path: root/pr
diff options
context:
space:
mode:
authorwtc%google.com <devnull@localhost>2012-09-28 14:21:22 +0000
committerwtc%google.com <devnull@localhost>2012-09-28 14:21:22 +0000
commit144c95768d4fc108e78608f731ab2460ea2c55ab (patch)
tree325be7f16e2fda20c2cd00b1d184bcebbd4b51e8 /pr
parent8e79e883c4d545d3e509c6ea0aeae39c0871d1d6 (diff)
downloadnspr-hg-144c95768d4fc108e78608f731ab2460ea2c55ab.tar.gz
Bug 794316: update the 'higher' pointer of the layer right below the new
top of the stack after the old top is popped. r=michal.novotny. Modified Files: pr/src/io/prlayer.c pr/tests/pushtop.c
Diffstat (limited to 'pr')
-rw-r--r--pr/src/io/prlayer.c4
-rw-r--r--pr/tests/pushtop.c11
2 files changed, 15 insertions, 0 deletions
diff --git a/pr/src/io/prlayer.c b/pr/src/io/prlayer.c
index 7519cd9f..faec9095 100644
--- a/pr/src/io/prlayer.c
+++ b/pr/src/io/prlayer.c
@@ -566,6 +566,10 @@ PR_IMPLEMENT(PRFileDesc*) PR_PopIOLayer(PRFileDesc *stack, PRDescIdentity id)
*stack = *extract;
*extract = copy;
stack->higher = NULL;
+ if (stack->lower) {
+ PR_ASSERT(stack->lower->higher == extract);
+ stack->lower->higher = stack;
+ }
} else if ((PR_IO_LAYER_HEAD == stack->identity) &&
(extract == stack->lower) && (extract->lower == NULL)) {
/*
diff --git a/pr/tests/pushtop.c b/pr/tests/pushtop.c
index bd09930f..621a7c72 100644
--- a/pr/tests/pushtop.c
+++ b/pr/tests/pushtop.c
@@ -48,6 +48,17 @@ int main()
top = PR_PopIOLayer(fd, topId);
top->dtor(top);
+
+ middle = fd;
+ bottom = middle->lower;
+
+ /* Verify that the higher pointer is correct. */
+ if (bottom->higher != middle) {
+ fprintf(stderr, "bottom->higher is wrong\n");
+ fprintf(stderr, "FAILED\n");
+ exit(1);
+ }
+
middle = PR_PopIOLayer(fd, middleId);
middle->dtor(middle);
if (fd->identity != bottomId) {