[webkit-changes] cvs commit: WebCore/khtml/html htmlparser.cpp

Maciej mjs at opensource.apple.com
Wed Oct 5 00:14:07 PDT 2005


mjs         05/10/05 00:14:07

  Modified:    .        ChangeLog
               khtml/html htmlparser.cpp
  Log:
          Reviewed by Eric.
  
  	- fixed a random crasher that happens because the HTMLParser accidentally was refing
  	the document.
  
  	I couldn't figure out how to make a reproducible test case for this. The failure is
  	random memory trashing.
  
          * khtml/html/htmlparser.cpp:
          (HTMLStackElem::HTMLStackElem):
          (HTMLStackElem::~HTMLStackElem):
          (HTMLParser::popNestedHeaderTag):
          (HTMLParser::handleResidualStyleCloseTagAcrossBlocks):
          (HTMLParser::popOneBlock):
  
  Revision  Changes    Path
  1.198     +18 -1     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.197
  retrieving revision 1.198
  diff -u -r1.197 -r1.198
  --- ChangeLog	5 Oct 2005 07:01:47 -0000	1.197
  +++ ChangeLog	5 Oct 2005 07:14:05 -0000	1.198
  @@ -1,3 +1,20 @@
  +2005-10-05  Maciej Stachowiak  <mjs at apple.com>
  +
  +        Reviewed by Eric.
  +
  +	- fixed a random crasher that happens because the HTMLParser accidentally was refing
  +	the document.
  +	
  +	I couldn't figure out how to make a reproducible test case for this. The failure is
  +	random memory trashing.
  +
  +        * khtml/html/htmlparser.cpp:
  +        (HTMLStackElem::HTMLStackElem):
  +        (HTMLStackElem::~HTMLStackElem):
  +        (HTMLParser::popNestedHeaderTag):
  +        (HTMLParser::handleResidualStyleCloseTagAcrossBlocks):
  +        (HTMLParser::popOneBlock):
  +
   2005-10-04  Maciej Stachowiak  <mjs at apple.com>
   
           Reviewed by Eric.
  @@ -8,7 +25,7 @@
   	random memory trashing.
   
           * khtml/ecma/kjs_events.cpp:
  -        (KJS::JSAbstractEventListener::handleEvent):
  +        (KJS::JSAbstractEventListener::handleEvent): Move an unpaired deref to where it is paired.
   
   2005-10-04  Eric Seidel  <eseidel at apple.com>
   
  
  
  
  1.116     +18 -7     WebCore/khtml/html/htmlparser.cpp
  
  Index: htmlparser.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/htmlparser.cpp,v
  retrieving revision 1.115
  retrieving revision 1.116
  diff -u -r1.115 -r1.116
  --- htmlparser.cpp	3 Oct 2005 21:12:30 -0000	1.115
  +++ htmlparser.cpp	5 Oct 2005 07:14:06 -0000	1.116
  @@ -84,13 +84,24 @@
           level(_level),
           strayTableContent(false),
           node(_node),
  +        holdingRef(!_node->isDocumentNode()),
           next(_next)
  -        { }
  +    {
  +        if (holdingRef)
  +            _node->ref();
  +    }
  +
  +    ~HTMLStackElem()
  +    {
  +        if (holdingRef)
  +            node->deref();
  +    }
   
       AtomicString tagName;
       int level;
       bool strayTableContent;
  -    SharedPtr<NodeImpl> node;
  +    NodeImpl *node;
  +    bool holdingRef;
       HTMLStackElem* next;
   };
   
  @@ -882,7 +893,7 @@
           }
           if (currNode && !isInline(currNode))
               return;
  -        currNode = curr->node.get();
  +        currNode = curr->node;
       }
   }
   
  @@ -990,9 +1001,9 @@
   
       if (!curr || !maxElem || !isAffectedByResidualStyle(maxElem->tagName)) return;
   
  -    NodeImpl* residualElem = prev->node.get();
  -    NodeImpl* blockElem = prevMaxElem ? prevMaxElem->node.get() : current;
  -    NodeImpl* parentElem = elem->node.get();
  +    NodeImpl* residualElem = prev->node;
  +    NodeImpl* blockElem = prevMaxElem ? prevMaxElem->node : current;
  +    NodeImpl* parentElem = elem->node;
   
       // Check to see if the reparenting that is going to occur is allowed according to the DOM.
       // FIXME: We should either always allow it or perform an additional fixup instead of
  @@ -1274,7 +1285,7 @@
       }
   
       blockStack = Elem->next;
  -    setCurrent(Elem->node.get());
  +    setCurrent(Elem->node);
   
       if (Elem->strayTableContent)
           inStrayTableContent--;
  
  
  



More information about the webkit-changes mailing list