Bug 60655

Summary: WebKit2 doesn't build on Mac with strict PassOwnPtr
Product: WebKit Reporter: Adam Barth <abarth>
Component: WebKit2Assignee: Sam Weinig <sam>
Status: RESOLVED FIXED    
Severity: Normal CC: sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch barraclough: review+

Description Adam Barth 2011-05-11 13:37:16 PDT
Index: Source/JavaScriptCore/wtf/PassOwnPtr.h
===================================================================
--- Source/JavaScriptCore/wtf/PassOwnPtr.h	(revision 86247)
+++ Source/JavaScriptCore/wtf/PassOwnPtr.h	(working copy)
@@ -33,7 +33,7 @@
 
 #if !PLATFORM(CHROMIUM) && !PLATFORM(WIN)
 // Remove this once we make all WebKit code compatible with stricter rules about PassOwnPtr.
-#define LOOSE_PASS_OWN_PTR
+// #define LOOSE_PASS_OWN_PTR
 #endif
 
 namespace WTF {




Build WebKit2 of project WebKit2 with configuration Debug

CompileC /Users/abarth/svn/webkit/WebKitBuild/WebKit2.build/Debug/WebKit2.build/Objects-normal/x86_64/PluginControllerProxyMessageReceiver.o /Users/abarth/svn/webkit/WebKitBuild/Debug/DerivedSources/WebKit2/PluginControllerProxyMessageReceiver.cpp normal x86_64 c++ com.apple.compilers.gcc.4_2
cd /Users/abarth/svn/webkit/Source/WebKit2
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x c++ -arch x86_64 -fmessage-length=0 -pipe -Wno-trigraphs -fno-exceptions -fno-rtti -fpascal-strings -fasm-blocks -O0 -Werror -Wmissing-prototypes -Wreturn-type -Wnon-virtual-dtor -Wunused-variable -Wnewline-eof -DDISABLE_THREAD_CHECK -DENABLE_WEBGL -DENABLE_3D_RENDERING -DENABLE_BLOB -DENABLE_CHANNEL_MESSAGING -DENABLE_CLIENT_BASED_GEOLOCATION -DENABLE_DATABASE -DENABLE_DATALIST -DENABLE_DETAILS -DENABLE_DOM_STORAGE -DENABLE_EVENTSOURCE -DENABLE_FILTERS -DENABLE_FULLSCREEN_API -DENABLE_GEOLOCATION -DENABLE_ICONDATABASE -DENABLE_JAVASCRIPT_DEBUGGER -DENABLE_MATHML -DENABLE_METER_TAG -DENABLE_OFFLINE_WEB_APPLICATIONS -DENABLE_PROGRESS_TAG -DENABLE_SHARED_WORKERS -DENABLE_SVG -DENABLE_SVG_ANIMATION -DENABLE_SVG_AS_IMAGE -DENABLE_SVG_DOM_OBJC_BINDINGS -DENABLE_SVG_FONTS -DENABLE_SVG_FOREIGN_OBJECT -DENABLE_SVG_USE -DENABLE_VIDEO -DENABLE_WEB_SOCKETS -DENABLE_WORKERS -DENABLE_XPATH -DENABLE_XSLT -DFRAMEWORK_NAME=WebKit2 -fvisibility=hidden -fvisibility-inlines-hidden -fno-threadsafe-statics -mmacosx-version-min=10.6 -gdwarf-2 -I/Users/abarth/svn/webkit/WebKitBuild/WebKit2.build/Debug/WebKit2.build/WebKit2.hmap -Wall -Wextra -Wchar-subscripts -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -F/Users/abarth/svn/webkit/WebKitBuild/Debug -F/Users/abarth/svn/webkit/WebKitBuild/Debug -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks -F/System/Library/Frameworks/Carbon.framework/Frameworks -F/System/Library/Frameworks/Quartz.framework/Frameworks -F/System/Library/Frameworks/CoreServices.framework/Frameworks -I/Users/abarth/svn/webkit/WebKitBuild/Debug/include -I/Users/abarth/svn/webkit/WebKitBuild/Debug/WebCore.framework/PrivateHeaders/ForwardingHeaders -I/Users/abarth/svn/webkit/WebKitBuild/Debug/WebCore.framework/PrivateHeaders/icu -I/Users/abarth/svn/webkit/WebKitBuild/Debug/usr/local/include -I/Users/abarth/svn/webkit/WebKitBuild/Debug/DerivedSources/WebKit2 -I/Users/abarth/svn/webkit/WebKitBuild/WebKit2.build/Debug/WebKit2.build/DerivedSources/x86_64 -I/Users/abarth/svn/webkit/WebKitBuild/WebKit2.build/Debug/WebKit2.build/DerivedSources -include /var/folders/Do/DoMaph5qFVqgE67TB2lr3k+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/WebKit2Prefix-culbqpxqjzqeiadivtmxqkvsjlgk/WebKit2Prefix.h -c /Users/abarth/svn/webkit/WebKitBuild/Debug/DerivedSources/WebKit2/PluginControllerProxyMessageReceiver.cpp -o /Users/abarth/svn/webkit/WebKitBuild/WebKit2.build/Debug/WebKit2.build/Objects-normal/x86_64/PluginControllerProxyMessageReceiver.o

/Users/abarth/svn/webkit/Source/WebKit2/Platform/CoreIPC/HandleMessage.h: In function 'void CoreIPC::handleMessageDelayed(CoreIPC::Connection*, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*, C*, MF) [with T = Messages::PluginControllerProxy::HandleMouseEvent, C = WebKit::PluginControllerProxy, MF = void (WebKit::PluginControllerProxy::*)(const WebKit::WebMouseEvent&, WTF::PassRefPtr<Messages::PluginControllerProxy::HandleMouseEvent::DelayedReply>)]':
/Users/abarth/svn/webkit/WebKitBuild/Debug/DerivedSources/WebKit2/PluginControllerProxyMessageReceiver.cpp:149:   instantiated from here
/Users/abarth/svn/webkit/Source/WebKit2/Platform/CoreIPC/HandleMessage.h:315: error: no matching function for call to 'Messages::PluginControllerProxy::HandleMouseEvent::DelayedReply::DelayedReply(CoreIPC::Connection*&, CoreIPC::ArgumentEncoder*&)'
/Users/abarth/svn/webkit/WebKitBuild/Debug/DerivedSources/WebKit2/PluginControllerProxyMessageReceiver.cpp:44: note: candidates are: Messages::PluginControllerProxy::HandleMouseEvent::DelayedReply::DelayedReply(WTF::PassRefPtr<CoreIPC::Connection>, WTF::PassOwnPtr<CoreIPC::ArgumentEncoder>)
/Users/abarth/svn/webkit/WebKitBuild/Debug/DerivedSources/WebKit2/PluginControllerProxyMessages.h:203: note:                 Messages::PluginControllerProxy::HandleMouseEvent::DelayedReply::DelayedReply(const Messages::PluginControllerProxy::HandleMouseEvent::DelayedReply&)

CompileC /Users/abarth/svn/webkit/WebKitBuild/WebKit2.build/Debug/WebKit2.build/Objects-normal/x86_64/WebProcessProxyMessageReceiver.o /Users/abarth/svn/webkit/WebKitBuild/Debug/DerivedSources/WebKit2/WebProcessProxyMessageReceiver.cpp normal x86_64 c++ com.apple.compilers.gcc.4_2
cd /Users/abarth/svn/webkit/Source/WebKit2
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x c++ -arch x86_64 -fmessage-length=0 -pipe -Wno-trigraphs -fno-exceptions -fno-rtti -fpascal-strings -fasm-blocks -O0 -Werror -Wmissing-prototypes -Wreturn-type -Wnon-virtual-dtor -Wunused-variable -Wnewline-eof -DDISABLE_THREAD_CHECK -DENABLE_WEBGL -DENABLE_3D_RENDERING -DENABLE_BLOB -DENABLE_CHANNEL_MESSAGING -DENABLE_CLIENT_BASED_GEOLOCATION -DENABLE_DATABASE -DENABLE_DATALIST -DENABLE_DETAILS -DENABLE_DOM_STORAGE -DENABLE_EVENTSOURCE -DENABLE_FILTERS -DENABLE_FULLSCREEN_API -DENABLE_GEOLOCATION -DENABLE_ICONDATABASE -DENABLE_JAVASCRIPT_DEBUGGER -DENABLE_MATHML -DENABLE_METER_TAG -DENABLE_OFFLINE_WEB_APPLICATIONS -DENABLE_PROGRESS_TAG -DENABLE_SHARED_WORKERS -DENABLE_SVG -DENABLE_SVG_ANIMATION -DENABLE_SVG_AS_IMAGE -DENABLE_SVG_DOM_OBJC_BINDINGS -DENABLE_SVG_FONTS -DENABLE_SVG_FOREIGN_OBJECT -DENABLE_SVG_USE -DENABLE_VIDEO -DENABLE_WEB_SOCKETS -DENABLE_WORKERS -DENABLE_XPATH -DENABLE_XSLT -DFRAMEWORK_NAME=WebKit2 -fvisibility=hidden -fvisibility-inlines-hidden -fno-threadsafe-statics -mmacosx-version-min=10.6 -gdwarf-2 -I/Users/abarth/svn/webkit/WebKitBuild/WebKit2.build/Debug/WebKit2.build/WebKit2.hmap -Wall -Wextra -Wchar-subscripts -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -F/Users/abarth/svn/webkit/WebKitBuild/Debug -F/Users/abarth/svn/webkit/WebKitBuild/Debug -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks -F/System/Library/Frameworks/Carbon.framework/Frameworks -F/System/Library/Frameworks/Quartz.framework/Frameworks -F/System/Library/Frameworks/CoreServices.framework/Frameworks -I/Users/abarth/svn/webkit/WebKitBuild/Debug/include -I/Users/abarth/svn/webkit/WebKitBuild/Debug/WebCore.framework/PrivateHeaders/ForwardingHeaders -I/Users/abarth/svn/webkit/WebKitBuild/Debug/WebCore.framework/PrivateHeaders/icu -I/Users/abarth/svn/webkit/WebKitBuild/Debug/usr/local/include -I/Users/abarth/svn/webkit/WebKitBuild/Debug/DerivedSources/WebKit2 -I/Users/abarth/svn/webkit/WebKitBuild/WebKit2.build/Debug/WebKit2.build/DerivedSources/x86_64 -I/Users/abarth/svn/webkit/WebKitBuild/WebKit2.build/Debug/WebKit2.build/DerivedSources -include /var/folders/Do/DoMaph5qFVqgE67TB2lr3k+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/WebKit2Prefix-culbqpxqjzqeiadivtmxqkvsjlgk/WebKit2Prefix.h -c /Users/abarth/svn/webkit/WebKitBuild/Debug/DerivedSources/WebKit2/WebProcessProxyMessageReceiver.cpp -o /Users/abarth/svn/webkit/WebKitBuild/WebKit2.build/Debug/WebKit2.build/Objects-normal/x86_64/WebProcessProxyMessageReceiver.o

/Users/abarth/svn/webkit/Source/WebKit2/Platform/CoreIPC/HandleMessage.h: In function 'void CoreIPC::handleMessageDelayed(CoreIPC::Connection*, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*, C*, MF) [with T = Messages::WebProcessProxy::GetPluginProcessConnection, C = WebKit::WebProcessProxy, MF = void (WebKit::WebProcessProxy::*)(const WTF::String&, WTF::PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>)]':
/Users/abarth/svn/webkit/WebKitBuild/Debug/DerivedSources/WebKit2/WebProcessProxyMessageReceiver.cpp:101:   instantiated from here
/Users/abarth/svn/webkit/Source/WebKit2/Platform/CoreIPC/HandleMessage.h:315: error: no matching function for call to 'Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply::DelayedReply(CoreIPC::Connection*&, CoreIPC::ArgumentEncoder*&)'
/Users/abarth/svn/webkit/WebKitBuild/Debug/DerivedSources/WebKit2/WebProcessProxyMessageReceiver.cpp:44: note: candidates are: Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply::DelayedReply(WTF::PassRefPtr<CoreIPC::Connection>, WTF::PassOwnPtr<CoreIPC::ArgumentEncoder>)
/Users/abarth/svn/webkit/WebKitBuild/Debug/DerivedSources/WebKit2/WebProcessProxyMessages.h:86: note:                 Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply::DelayedReply(const Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply&)
Comment 1 Sam Weinig 2011-05-11 17:16:06 PDT
Created attachment 93216 [details]
Patch
Comment 2 Sam Weinig 2011-05-11 17:58:35 PDT
Committed r86296: <http://trac.webkit.org/changeset/86296>
Comment 3 Adam Barth 2011-05-11 18:20:29 PDT
Comment on attachment 93216 [details]
Patch

I'm not sure this patch is right.  Does that mean we're supposed to leak the replyEncoder if the arguments fail to decode?  If this function is supposed take ownership, It seems more likely we should change the parameter to be a PassOwnPtr.
Comment 4 Adam Barth 2011-05-11 19:45:10 PDT
I tried chasing this for a while, but it mushroomed out of control pretty fast.  I suspect there's a memory management bug here somewhere.
Comment 5 Adam Barth 2011-05-11 19:50:21 PDT
For example, consider PluginControllerProxy::didReceiveSyncPluginControllerProxyMessage.  Whether this function eventually calls delete on its third argument appears to depend on the MessageID.