Changeset 53477 in webkit
- Timestamp:
- Jan 19, 2010 11:11:23 AM (14 years ago)
- Location:
- trunk/WebKit/gtk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/gtk/ChangeLog
r53351 r53477 1 2010-01-19 Gustavo Noronha Silva <gns@gnome.org> 2 3 Reviewed by Xan Lopez. 4 5 [GTK] More crashes related to the clipboard management 6 https://bugs.webkit.org/show_bug.cgi?id=33746 7 8 Pass the WebKitWebView object (which is a GObject, thus 9 ref-counted) to the clipboard functions instead of passing the 10 Page - this allows us to explicitely protect the object inbetween 11 the clipboard call and its callbacks, which fixes the crash. 12 13 * WebCoreSupport/EditorClientGtk.cpp: 14 (WebKit::EditorClient::respondToChangedSelection): 15 * WebCoreSupport/PasteboardHelperGtk.cpp: 16 (WebKit::getClipboardContentsCallback): 17 (WebKit::clearClipboardContentsCallback): 18 (WebKit::PasteboardHelperGtk::writeClipboardContents): 19 1 20 2010-01-15 Alejandro G. Castro <alex@igalia.com> 2 21 -
trunk/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
r53264 r53477 207 207 dataObject->clear(); 208 208 dataObject->setRange(targetFrame->selection()->toNormalizedRange()); 209 pasteboardHelperInstance()->writeClipboardContents(clipboard, corePage);209 pasteboardHelperInstance()->writeClipboardContents(clipboard, m_webView); 210 210 } 211 211 #endif -
trunk/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
r53304 r53477 123 123 DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard); 124 124 ASSERT(dataObject); 125 dataObject->clear(); 125 126 126 dataObject->clear();127 if ( data) {128 WebCore::Page* corePage = reinterpret_cast<WebCore::Page*>(data);127 // This will be true for clipboards other than X11 primary. 128 if (!data) 129 return; 129 130 130 if (!corePage->focusController())131 return;131 WebKitWebView* webView = reinterpret_cast<WebKitWebView*>(data); 132 WebCore::Page* corePage = core(webView); 132 133 133 Frame* frame = corePage->focusController()->focusedOrMainFrame(); 134 if (!corePage || !corePage->focusController()) { 135 g_object_unref(webView); 136 return; 137 } 134 138 135 // Collapse the selection without clearing it 136 ASSERT(frame); 137 frame->selection()->setBase(frame->selection()->extent(), frame->selection()->affinity()); 138 } 139 Frame* frame = corePage->focusController()->focusedOrMainFrame(); 140 141 // Collapse the selection without clearing it 142 ASSERT(frame); 143 frame->selection()->setBase(frame->selection()->extent(), frame->selection()->affinity()); 144 145 g_object_unref(webView); 139 146 } 140 147 … … 149 156 if (numberOfTargets > 0 && table) { 150 157 settingClipboard = true; 151 gtk_clipboard_set_with_data(clipboard, table, numberOfTargets, 152 getClipboardContentsCallback, 153 clearClipboardContentsCallback, data); 158 159 // Protect the web view from being destroyed before one of the clipboard callbacks 160 // is called. Balanced in both getClipboardContentsCallback and 161 // clearClipboardContentsCallback. 162 WebKitWebView* webView = static_cast<WebKitWebView*>(data); 163 g_object_ref(webView); 164 165 gboolean succeeded = gtk_clipboard_set_with_data(clipboard, table, numberOfTargets, 166 getClipboardContentsCallback, 167 clearClipboardContentsCallback, data); 168 if (!succeeded) 169 g_object_unref(webView); 170 154 171 settingClipboard = false; 155 172 } else
Note: See TracChangeset
for help on using the changeset viewer.