Reviewed by Ken.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 20 Mar 2005 00:58:28 +0000 (00:58 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 20 Mar 2005 00:58:28 +0000 (00:58 +0000)
        - fixed <rdar://problem/4057594> REGRESSION (125-406): Unrepro crash in HTMLTokenizer::allDataProcessed after hitting Back button

        * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::allDataProcessed):
        To get the part safely after calling end, save a guarded pointer to the view.
        The old way could end trying to call a virtual function a part that was destroyed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8936 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/html/htmltokenizer.cpp

index 37dbaa7a8f6ba928be0742c491196a5d418191ba..4c68ed633b9028d0ec63f2f5b5357995a9030f2b 100644 (file)
@@ -1,10 +1,19 @@
+2005-03-19  Darin Adler  <darin@apple.com>
+
+        Reviewed by Ken.
+
+        - fixed <rdar://problem/4057594> REGRESSION (125-406): Unrepro crash in HTMLTokenizer::allDataProcessed after hitting Back button
+
+        * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::allDataProcessed):
+        To get the part safely after calling end, save a guarded pointer to the view.
+        The old way could end trying to call a virtual function a part that was destroyed.
+
 2005-03-18  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Darin.
 
        <rdar://problem/4053506> Pasting Tables and Cells in Mail does not allow editing before or after
        <rdar://problem/4005954> REGRESSION (Mail): After copy/paste of content containing list element cannot go back to entering text at left side of page
-
        
         * khtml/editing/htmlediting.cpp:
         (khtml::maxDeepOffset):
index d25942e3d5439a75cd35259785791aa6aaba0970..bd914381ceea5ee55a1e9a0b0b23252afa76c4be 100644 (file)
@@ -1875,11 +1875,14 @@ void HTMLTokenizer::timerEvent(QTimerEvent* e)
 void HTMLTokenizer::allDataProcessed()
 {
     if (noMoreData && !inWrite && !loadingExtScript && !m_executingScript && !onHold && !timerId) {
-        if (!parser || !parser->doc() || !parser->doc()->part())
-            return;
-        KHTMLPart* part = parser->doc()->part();
+        QGuardedPtr<KHTMLView> savedView = view;
         end();
-        part->tokenizerProcessedData();
+        if (savedView) {
+            KHTMLPart *part = savedView->part();
+            if (part) {
+                part->tokenizerProcessedData();
+            }
+        }
     }
 }