2010-07-04 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 4 Jul 2010 09:41:06 +0000 (09:41 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 4 Jul 2010 09:41:06 +0000 (09:41 +0000)
        Reviewed by Mark Rowe.

        WebProcess crashes in release for simple layout tests
        https://bugs.webkit.org/show_bug.cgi?id=41575

        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
        (WKBundlePageCopyRenderTreeExternalRepresentation): ref external representation StringImpl*
        before taking it out of its parent String, to avoid returning freed memory.

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

WebKit2/ChangeLog
WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp

index f96d82febc56127240e42c7776ba20b7501a9271..8050c8d7fd1e54c18fcffd9f9d653942eda34f0f 100644 (file)
@@ -1,3 +1,14 @@
+2010-07-04  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Mark Rowe.
+
+        WebProcess crashes in release for simple layout tests
+        https://bugs.webkit.org/show_bug.cgi?id=41575
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageCopyRenderTreeExternalRepresentation): ref external representation StringImpl*
+        before taking it out of its parent String, to avoid returning freed memory.
+
 2010-07-03  Maciej Stachowiak  <mjs@apple.com>
 
         Rubber stamped by Anders Carlsson.
index e811ef0047ed0762c9649e188fce81f28d340312..a5d2e90f8b14268dded289b37c9590a74abe9316 100644 (file)
@@ -46,7 +46,7 @@ WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef pageRef)
 
 WKStringRef WKBundlePageCopyRenderTreeExternalRepresentation(WKBundlePageRef pageRef)
 {
-    WebCore::StringImpl* string = toWK(pageRef)->renderTreeExternalRepresentation().impl();
-    string->ref();
-    return toRef(string);
+    WebCore::String string = toWK(pageRef)->renderTreeExternalRepresentation();
+    string.impl()->ref();
+    return toRef(string.impl());
 }