Changeset 91266 in webkit
- Timestamp:
- Jul 19, 2011 10:14:47 AM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r91248 r91266 1 2011-07-18 Brian Weinstein <bweinstein@apple.com> 2 3 Speculative fix for: Crash under WebPage::platformDragEnded when dragging on Mac 4 https://bugs.webkit.org/show_bug.cgi?id=64766 5 <rdar://problem/9548174> 6 7 Reviewed by Enrica Casucci. 8 9 I was unable to reproduce this bug, but Darin Adler and I discussed the probable issue. When starting the drag, we create 10 a WKPasteboardFilePromiseOwner, and a WKPasteboardOwner. When the drag is concluded, we call a method on the WKPasteboardFilePromiseOwner 11 which uses the WKPasteboardOwner. However, we are not guaranteeing that the WKPasteboardOwner will be around when the 12 WKPasteboardFilePromiseOwner method is called. 13 14 The fix is to retain both the WKPasteboardFilePromiseOwner and the WKPasteboardOwner that we need, making sure that we are keeping 15 both objects alive. 16 17 This patch also uses r91222 to replace WebPage::platformDragEnded, so WebPage doesn't need to know about the drag source. 18 19 * WebProcess/WebCoreSupport/WebDragClient.cpp: 20 (WebKit::WebDragClient::dragEnded): Add a non-Mac stub method, since the Mac is the only platform that does something here. 21 * WebProcess/WebCoreSupport/WebDragClient.h: 22 * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: 23 (WebKit::WebDragClient::declareAndWriteDragImage): Use member variables instead of local variables. 24 (WebKit::WebDragClient::dragEnded): Move code from WebPageMac::platformDragEnded to here, and clear both member variables. 25 * WebProcess/WebPage/WebPage.cpp: 26 (WebKit::WebPage::dragEnded): Don't call platformDragEnded anymore. WebCore::DragController::dragEnded calls WebDragClient::dragEnded, 27 which does the same thing. 28 * WebProcess/WebPage/WebPage.h: 29 * WebProcess/WebPage/mac/WebPageMac.mm: Remove platformDragEnded. 30 1 31 2011-07-18 Alexis Menard <alexis.menard@openbossa.org> 2 32 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp
r89582 r91266 59 59 #endif 60 60 61 #if !PLATFORM(MAC) 62 void WebDragClient::dragEnded() 63 { 64 } 65 #endif 66 61 67 void WebDragClient::dragControllerDestroyed() 62 68 { -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h
r77870 r91266 29 29 #include <WebCore/DragClient.h> 30 30 31 #if PLATFORM(MAC) 32 #ifdef __OBJC__ 33 @class WKPasteboardFilePromiseOwner; 34 @class WKPasteboardOwner; 35 #else 36 class WKPasteboardFilePromiseOwner; 37 class WKPasteboardOwner; 38 #endif 39 #endif 40 31 41 namespace WebKit { 32 42 … … 51 61 virtual void declareAndWriteDragImage(NSPasteboard*, DOMElement*, NSURL*, NSString*, WebCore::Frame*); 52 62 #endif 63 64 virtual void dragEnded(); 65 53 66 virtual void dragControllerDestroyed(); 54 67 55 68 WebPage* m_page; 69 70 #if PLATFORM(MAC) 71 RetainPtr<WKPasteboardFilePromiseOwner> m_filePromiseOwner; 72 RetainPtr<WKPasteboardOwner> m_pasteboardOwner; 73 #endif 56 74 }; 57 75 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm
r86451 r91266 149 149 [types.get() addObjectsFromArray:archive ? PasteboardTypes::forImagesWithArchive() : PasteboardTypes::forImages()]; 150 150 151 RetainPtr<WKPasteboardOwner> pasteboardOwner(AdoptNS, [[WKPasteboardOwner alloc] initWithImage:image]); 152 153 RetainPtr<WKPasteboardFilePromiseOwner> filePromiseOwner(AdoptNS, [(WKPasteboardFilePromiseOwner *)[WKPasteboardFilePromiseOwner alloc] initWithSource:pasteboardOwner.get()]); 154 m_page->setDragSource(filePromiseOwner.get()); 155 156 [pasteboard declareTypes:types.get() owner:pasteboardOwner.leakRef()]; 151 m_pasteboardOwner.adoptNS([[WKPasteboardOwner alloc] initWithImage:image]); 152 m_filePromiseOwner.adoptNS([(WKPasteboardFilePromiseOwner *)[WKPasteboardFilePromiseOwner alloc] initWithSource:m_pasteboardOwner.get()]); 153 154 [pasteboard declareTypes:types.get() owner:m_pasteboardOwner.leakRef()]; 157 155 158 156 [pasteboard setPropertyList:[NSArray arrayWithObject:extension] forType:NSFilesPromisePboardType]; 159 157 160 [ filePromiseOwner.get() setTypes:[pasteboard propertyListForType:NSFilesPromisePboardType] onPasteboard:pasteboard];158 [m_filePromiseOwner.get() setTypes:[pasteboard propertyListForType:NSFilesPromisePboardType] onPasteboard:pasteboard]; 161 159 162 160 [URL writeToPasteboard:pasteboard]; … … 172 170 if (archive) 173 171 [pasteboard setData:(NSData *)archive->rawDataRepresentation().get() forType:PasteboardTypes::WebArchivePboardType]; 172 } 173 174 void WebDragClient::dragEnded() 175 { 176 // The drag source we care about here is NSFilePromiseDragSource, which doesn't look at 177 // the arguments. It's OK to just pass arbitrary constant values, so we just pass all zeroes. 178 [m_filePromiseOwner.get() draggedImage:nil endedAt:NSZeroPoint operation:NSDragOperationNone]; 179 180 m_pasteboardOwner = nullptr; 181 m_filePromiseOwner = nullptr; 174 182 } 175 183 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r91232 r91266 1797 1797 IntPoint adjustedClientPosition(clientPosition.x() + m_page->dragController()->dragOffset().x(), clientPosition.y() + m_page->dragController()->dragOffset().y()); 1798 1798 IntPoint adjustedGlobalPosition(globalPosition.x() + m_page->dragController()->dragOffset().x(), globalPosition.y() + m_page->dragController()->dragOffset().y()); 1799 1800 platformDragEnded(); 1799 1801 1800 m_page->dragController()->dragEnded(); 1802 1801 FrameView* view = m_page->mainFrame()->view(); … … 2411 2410 } 2412 2411 2413 #if !PLATFORM(MAC)2414 void WebPage::platformDragEnded()2415 {2416 }2417 #endif2418 2419 2412 bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request) 2420 2413 { -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r91064 r91266 419 419 void unmarkAllBadGrammar(); 420 420 421 #if PLATFORM(MAC)422 void setDragSource(NSObject *);423 #endif424 425 421 #if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) 426 422 void handleCorrectionPanelResult(const String&); … … 567 563 #endif 568 564 569 void platformDragEnded();570 571 565 void setCanStartMediaTimerFired(); 572 566 … … 612 606 613 607 RetainPtr<AccessibilityWebPageObject> m_mockAccessibilityElement; 614 615 RetainPtr<NSObject> m_dragSource;616 608 617 609 WebCore::KeyboardEvent* m_keyboardEventBeingInterpreted; -
trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
r88667 r91266 680 680 } 681 681 682 void WebPage::setDragSource(NSObject *dragSource)683 {684 m_dragSource = dragSource;685 }686 687 void WebPage::platformDragEnded()688 {689 // The draggedImage method releases its responder; we retain here to balance that.690 [m_dragSource.get() retain];691 // The drag source we care about here is NSFilePromiseDragSource, which doesn't look at692 // the arguments. It's OK to just pass arbitrary constant values, so we just pass all zeroes.693 [m_dragSource.get() draggedImage:nil endedAt:NSZeroPoint operation:NSDragOperationNone];694 m_dragSource = nullptr;695 }696 697 682 void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent& event, bool& result) 698 683 {
Note: See TracChangeset
for help on using the changeset viewer.