patch for oft-seen crash in HTMLTokenizer::notifyFinished

John Sullivan sullivan at apple.com
Tue Dec 16 20:38:10 CET 2003


We had many reports of crashes with the same backtrace. One 
almost-always-reproducible one was:

1. Go to: www.oxfordart.com/pages/index.html
2. Click on the first pic under "flotsam" (lower right of page)
3. Many windows open and close before finally crashing.

Patch is enclosed.


-------------- next part --------------
Index: WebCore/khtml/html/htmltokenizer.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/html/htmltokenizer.cpp,v
retrieving revision 1.47
diff -u -r1.47 htmltokenizer.cpp
--- htmltokenizer.cpp	2003/12/11 23:50:09	1.47
+++ htmltokenizer.cpp	2003/12/16 19:04:10
@@ -1809,8 +1809,6 @@
         kdDebug( 6036 ) << "Finished loading an external script" << endl;
 #endif
         CachedScript* cs = cachedScript.dequeue();
-        finished = cachedScript.isEmpty();
-        if (finished) loadingExtScript = false;
         DOMString scriptSource = cs->script();
 #ifdef TOKEN_DEBUG
         kdDebug( 6036 ) << "External script is:" << endl << scriptSource.string() << endl;
@@ -1823,6 +1821,10 @@
         cs->deref(this);
 
 	scriptExecution( scriptSource.string(), cachedScriptUrl );
+        // cachedScript.isEmpty() can change inside the scriptExecution() call above,
+        // so don't test it until afterwards.
+        finished = cachedScript.isEmpty();
+        if (finished) loadingExtScript = false;
 
         // 'script' is true when we are called synchronously from
         // parseScript(). In that case parseScript() will take care
-------------- next part --------------



More information about the Khtml-devel mailing list