Title: [118505] trunk/Source/WebKit2
Revision
118505
Author
[email protected]
Date
2012-05-25 03:02:28 -0700 (Fri, 25 May 2012)

Log Message

Mac bots crashing under PluginInfo destructor.
<http://webkit.org/b/87414>
<rdar://problem/11527172>

Reviewed by Darin Adler.

We can't safely pass WTF::String to another thread without a deref() race,
so pass the PluginInfo vector by pointer instead of by value.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::sendDidGetPlugins):
(WebKit::WebContext::handleGetPlugins):
* UIProcess/WebContext.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (118504 => 118505)


--- trunk/Source/WebKit2/ChangeLog	2012-05-25 09:49:55 UTC (rev 118504)
+++ trunk/Source/WebKit2/ChangeLog	2012-05-25 10:02:28 UTC (rev 118505)
@@ -1,3 +1,19 @@
+2012-05-24  Andreas Kling  <[email protected]>
+
+        Mac bots crashing under PluginInfo destructor.
+        <http://webkit.org/b/87414>
+        <rdar://problem/11527172>
+
+        Reviewed by Darin Adler.
+
+        We can't safely pass WTF::String to another thread without a deref() race,
+        so pass the PluginInfo vector by pointer instead of by value.
+
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::sendDidGetPlugins):
+        (WebKit::WebContext::handleGetPlugins):
+        * UIProcess/WebContext.h:
+
 2012-05-25  Zalan Bujtas  <[email protected]>
 
         [Qt][WK2] Fix failing qmltests::FitToView::test_basic()

Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (118504 => 118505)


--- trunk/Source/WebKit2/UIProcess/WebContext.cpp	2012-05-25 09:49:55 UTC (rev 118504)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp	2012-05-25 10:02:28 UTC (rev 118505)
@@ -612,20 +612,20 @@
     m_visitedLinkProvider.addVisitedLink(linkHash);
 }
 
-void WebContext::sendDidGetPlugins(uint64_t requestID, const Vector<PluginInfo>& pluginInfos)
+void WebContext::sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<PluginInfo> > pluginInfos)
 {
     ASSERT(isMainThread());
 
-    Vector<PluginInfo> plugins(pluginInfos);
+    OwnPtr<Vector<PluginInfo> > plugins(pluginInfos);
 
 #if PLATFORM(MAC)
     // Add built-in PDF last, so that it's not used when a real plug-in is installed.
     // NOTE: This has to be done on the main thread as it calls localizedString().
     if (!omitPDFSupport())
-        plugins.append(BuiltInPDFView::pluginInfo());
+        plugins->append(BuiltInPDFView::pluginInfo());
 #endif
 
-    process()->send(Messages::WebProcess::DidGetPlugins(requestID, plugins), 0);
+    process()->send(Messages::WebProcess::DidGetPlugins(requestID, *plugins), 0);
 }
 
 void WebContext::handleGetPlugins(uint64_t requestID, bool refresh)
@@ -633,13 +633,15 @@
     if (refresh)
         m_pluginInfoStore.refresh();
 
-    Vector<PluginInfo> pluginInfos;
+    OwnPtr<Vector<PluginInfo> > pluginInfos = adoptPtr(new Vector<PluginInfo>);
 
     Vector<PluginModuleInfo> plugins = m_pluginInfoStore.plugins();
     for (size_t i = 0; i < plugins.size(); ++i)
-        pluginInfos.append(plugins[i].info);
+        pluginInfos->append(plugins[i].info);
 
-    RunLoop::main()->dispatch(bind(&WebContext::sendDidGetPlugins, this, requestID, pluginInfos));
+    // NOTE: We have to pass the PluginInfo vector to the secondary thread via a pointer as otherwise
+    //       we'd end up with a deref() race on all the WTF::Strings it contains.
+    RunLoop::main()->dispatch(bind(&WebContext::sendDidGetPlugins, this, requestID, pluginInfos.release()));
 }
 
 void WebContext::getPlugins(CoreIPC::Connection*, uint64_t requestID, bool refresh)

Modified: trunk/Source/WebKit2/UIProcess/WebContext.h (118504 => 118505)


--- trunk/Source/WebKit2/UIProcess/WebContext.h	2012-05-25 09:49:55 UTC (rev 118504)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h	2012-05-25 10:02:28 UTC (rev 118505)
@@ -262,7 +262,7 @@
     String platformDefaultLocalStorageDirectory() const;
 
     void handleGetPlugins(uint64_t requestID, bool refresh);
-    void sendDidGetPlugins(uint64_t requestID, const Vector<WebCore::PluginInfo>&);
+    void sendDidGetPlugins(uint64_t requestID, PassOwnPtr<Vector<WebCore::PluginInfo> >);
 
     ProcessModel m_processModel;
     
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to