[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:48:22 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 81af16e844278dc74644d7688214ecdc48b9947c
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 9 16:48:46 2002 +0000

    	- fixed 3069749 -- crash in QString during third run of cvs-base
    
            * kwq/KWQString.mm:
            (checkNodeAllocationPages): Added function to use for debugging.
            (_allocateNode): Clear the next pointer after removing a page from the free
    	node list so that the free node list doesn't point at part of the used node list.
            (freeHandle): Change the code around so that the code to add the node to the
    	free list works even in the case where this was the top from the used list.
    	The old code would half-remove the node from the used list and not add it to
    	the free list at all.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2290 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 8599c07..6b92935 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,18 @@
 2002-10-09  Darin Adler  <darin at apple.com>
 
+	- fixed 3069749 -- crash in QString during third run of cvs-base
+
+        * kwq/KWQString.mm:
+        (checkNodeAllocationPages): Added function to use for debugging.
+        (_allocateNode): Clear the next pointer after removing a page from the free
+	node list so that the free node list doesn't point at part of the used node list.
+        (freeHandle): Change the code around so that the code to add the node to the
+	free list works even in the case where this was the top from the used list.
+	The old code would half-remove the node from the used list and not add it to
+	the free list at all.
+
+2002-10-09  Darin Adler  <darin at apple.com>
+
         * WebCore.pbproj/project.pbxproj: Project Builder wanted to set encodings
 	for new files. Maybe Richard is not using the new Project Builder on all
 	his machines?
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 8599c07..6b92935 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,18 @@
 2002-10-09  Darin Adler  <darin at apple.com>
 
+	- fixed 3069749 -- crash in QString during third run of cvs-base
+
+        * kwq/KWQString.mm:
+        (checkNodeAllocationPages): Added function to use for debugging.
+        (_allocateNode): Clear the next pointer after removing a page from the free
+	node list so that the free node list doesn't point at part of the used node list.
+        (freeHandle): Change the code around so that the code to add the node to the
+	free list works even in the case where this was the top from the used list.
+	The old code would half-remove the node from the used list and not add it to
+	the free list at all.
+
+2002-10-09  Darin Adler  <darin at apple.com>
+
         * WebCore.pbproj/project.pbxproj: Project Builder wanted to set encodings
 	for new files. Maybe Richard is not using the new Project Builder on all
 	his machines?
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 8599c07..6b92935 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,18 @@
 2002-10-09  Darin Adler  <darin at apple.com>
 
+	- fixed 3069749 -- crash in QString during third run of cvs-base
+
+        * kwq/KWQString.mm:
+        (checkNodeAllocationPages): Added function to use for debugging.
+        (_allocateNode): Clear the next pointer after removing a page from the free
+	node list so that the free node list doesn't point at part of the used node list.
+        (freeHandle): Change the code around so that the code to add the node to the
+	free list works even in the case where this was the top from the used list.
+	The old code would half-remove the node from the used list and not add it to
+	the free list at all.
+
+2002-10-09  Darin Adler  <darin at apple.com>
+
         * WebCore.pbproj/project.pbxproj: Project Builder wanted to set encodings
 	for new files. Maybe Richard is not using the new Project Builder on all
 	his machines?
diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index 5922efb..42fffec 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -2701,6 +2701,43 @@ struct HandleNode {
 static HandlePageNode *usedNodeAllocationPages = 0;
 static HandlePageNode *freeNodeAllocationPages = 0;
 
+#if 1 // change to 0 to do the page lists checks
+
+#define CHECK_PAGE_LISTS() ((void)0)
+
+#else
+
+static void CHECK_PAGE_LISTS()
+{
+    {
+        int loopCount = 0;
+        HandlePageNode *next = 0;
+        for (HandlePageNode *page = freeNodeAllocationPages; page; page = page->previous) {
+            ASSERT(page->next == next);
+            ASSERT(((HandleNode *)page->nodes)[0].type.freeNodes);
+            if (++loopCount > 100) {
+                FATAL("free node page loop");
+            }
+            next = page;
+        }
+    }
+    
+    {
+        int loopCount = 0;
+        HandlePageNode *next = 0;
+        for (HandlePageNode *page = usedNodeAllocationPages; page; page = page->previous) {
+            ASSERT(page->next == next);
+            ASSERT(((HandleNode *)page->nodes)[0].type.freeNodes == 0);
+            if (++loopCount > 100) {
+                FATAL("used node page loop");
+            }
+            next = page;
+        }
+    }
+}
+
+#endif
+
 static HandleNode *_initializeHandleNodeBlock(HandlePageNode *pageNode)
 {
     uint i;
@@ -2739,11 +2776,13 @@ HandlePageNode *_allocatePageNode()
 void _initializeHandleNodes()
 {
     if (freeNodeAllocationPages == 0)
-        freeNodeAllocationPages = _allocatePageNode();    
+        freeNodeAllocationPages = _allocatePageNode();
 }
 
 HandleNode *_allocateNode(HandlePageNode *pageNode)
 {
+    CHECK_PAGE_LISTS();
+
     HandleNode *block = (HandleNode *)pageNode->nodes;
     HandleNode *freeNodes = block[0].type.freeNodes;
     HandleNode *allocated;
@@ -2759,20 +2798,26 @@ HandleNode *_allocateNode(HandlePageNode *pageNode)
     if (allocated->type.internalNode.previous >= 2) {
         block[0].type.freeNodes = TO_NODE_ADDRESS(allocated->type.internalNode.previous, block);
         block[0].type.freeNodes->type.internalNode.next = 0;
+
+        CHECK_PAGE_LISTS();
     }
     else {
         // Used last node on this page.
         block[0].type.freeNodes = 0;
         
         freeNodeAllocationPages = freeNodeAllocationPages->previous;
+        if (freeNodeAllocationPages)
+            freeNodeAllocationPages->next = 0;
 
         pageNode->previous = usedNodeAllocationPages;
         pageNode->next = 0;
         if (usedNodeAllocationPages)
             usedNodeAllocationPages->next = pageNode;
         usedNodeAllocationPages = pageNode;        
+    
+        CHECK_PAGE_LISTS();
     }
-        
+
     return allocated;
 }
 
@@ -2800,6 +2845,8 @@ void freeHandle(void *_free)
     return;
 #endif
 
+    CHECK_PAGE_LISTS();
+
     HandleNode *free = (HandleNode *)_free;
     HandleNode *base = (HandleNode *)trunc_page((uint)free);
     HandleNode *freeNodes = base[0].type.freeNodes;
@@ -2817,13 +2864,13 @@ void freeHandle(void *_free)
     base[0].type.freeNodes = free;
     
     // Remove page from used/free list and place on free list
-    if (usedNodeAllocationPages == pageNode)
-        usedNodeAllocationPages = usedNodeAllocationPages->previous;
-    else if (freeNodeAllocationPages != pageNode){
+    if (freeNodeAllocationPages != pageNode) {
         if (pageNode->previous)
             pageNode->previous->next = pageNode->next;
         if (pageNode->next)
             pageNode->next->previous = pageNode->previous;
+        if (usedNodeAllocationPages == pageNode)
+            usedNodeAllocationPages = pageNode->previous;
     
         pageNode->previous = freeNodeAllocationPages;
         pageNode->next = 0;
@@ -2832,6 +2879,8 @@ void freeHandle(void *_free)
         freeNodeAllocationPages = pageNode;
     }
     
+    CHECK_PAGE_LISTS();
+
 #ifdef QSTRING_DEBUG_ALLOCATIONS
     handleInstances--;
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list