Changeset 206985 in webkit
- Timestamp:
- Oct 10, 2016 12:12:35 AM (8 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r206979 r206985 1 2016-10-10 Tomas Popela <tpopela@redhat.com> 2 3 [GTK] UIProcess crashes when using Japanese IM 4 https://bugs.webkit.org/show_bug.cgi?id=163011 5 6 We have to reference the current GdkEventKey before we try process it 7 as later when the lambda body is reached the event could be already 8 freed. 9 10 Reviewed by Carlos Garcia Campos. 11 12 * UIProcess/API/gtk/WebKitWebViewBase.cpp: 13 (webkitWebViewBaseKeyPressEvent): 14 (webkitWebViewBaseKeyReleaseEvent): 15 * UIProcess/gtk/InputMethodFilter.h: 16 Use non-copyable Function so we can use WTFMove to pass the event to 17 lambda. 18 1 19 2016-10-09 Wenson Hsieh <wenson_hsieh@apple.com> 2 20 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
r206915 r206985 675 675 } 676 676 677 static gboolean webkitWebViewBaseKeyPressEvent(GtkWidget* widget, GdkEventKey* event)677 static gboolean webkitWebViewBaseKeyPressEvent(GtkWidget* widget, GdkEventKey* keyEvent) 678 678 { 679 679 WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); … … 681 681 682 682 if (priv->authenticationDialog) 683 return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->key_press_event(widget, event);683 return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->key_press_event(widget, keyEvent); 684 684 685 685 #if ENABLE(FULLSCREEN_API) 686 686 if (priv->fullScreenModeActive) { 687 switch ( event->keyval) {687 switch (keyEvent->keyval) { 688 688 case GDK_KEY_Escape: 689 689 case GDK_KEY_f: … … 703 703 if (priv->shouldForwardNextKeyEvent) { 704 704 priv->shouldForwardNextKeyEvent = FALSE; 705 return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->key_press_event(widget, event); 706 } 707 708 priv->inputMethodFilter.filterKeyEvent(event, [priv, event](const WebCore::CompositionResults& compositionResults, InputMethodFilter::EventFakedForComposition faked) { 709 priv->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(reinterpret_cast<GdkEvent*>(event), compositionResults, faked, 710 !compositionResults.compositionUpdated() ? priv->keyBindingTranslator.commandsForKeyEvent(event) : Vector<String>())); 705 return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->key_press_event(widget, keyEvent); 706 } 707 708 // We need to copy the event as otherwise it could be destroyed before we reach the lambda body. 709 GUniquePtr<GdkEvent> event(gdk_event_copy(reinterpret_cast<GdkEvent*>(keyEvent))); 710 priv->inputMethodFilter.filterKeyEvent(keyEvent, [priv, event = WTFMove(event)](const WebCore::CompositionResults& compositionResults, InputMethodFilter::EventFakedForComposition faked) { 711 priv->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(event.get(), compositionResults, faked, 712 !compositionResults.compositionUpdated() ? priv->keyBindingTranslator.commandsForKeyEvent(&event->key) : Vector<String>())); 711 713 }); 712 714 … … 714 716 } 715 717 716 static gboolean webkitWebViewBaseKeyReleaseEvent(GtkWidget* widget, GdkEventKey* event)718 static gboolean webkitWebViewBaseKeyReleaseEvent(GtkWidget* widget, GdkEventKey* keyEvent) 717 719 { 718 720 WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); … … 721 723 if (priv->shouldForwardNextKeyEvent) { 722 724 priv->shouldForwardNextKeyEvent = FALSE; 723 return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->key_release_event(widget, event); 724 } 725 726 priv->inputMethodFilter.filterKeyEvent(event, [priv, event](const WebCore::CompositionResults& compositionResults, InputMethodFilter::EventFakedForComposition faked) { 727 priv->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(reinterpret_cast<GdkEvent*>(event), compositionResults, faked, { })); 725 return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->key_release_event(widget, keyEvent); 726 } 727 728 // We need to copy the event as otherwise it could be destroyed before we reach the lambda body. 729 GUniquePtr<GdkEvent> event(gdk_event_copy(reinterpret_cast<GdkEvent*>(keyEvent))); 730 priv->inputMethodFilter.filterKeyEvent(keyEvent, [priv, event = WTFMove(event)](const WebCore::CompositionResults& compositionResults, InputMethodFilter::EventFakedForComposition faked) { 731 priv->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(event.get(), compositionResults, faked, { })); 728 732 }); 729 733 -
trunk/Source/WebKit2/UIProcess/gtk/InputMethodFilter.h
r206915 r206985 22 22 23 23 #include <WebCore/IntPoint.h> 24 #include < functional>24 #include <wtf/Function.h> 25 25 #include <wtf/Noncopyable.h> 26 26 #include <wtf/glib/GRefPtr.h> … … 57 57 void setCursorRect(const WebCore::IntRect&); 58 58 59 using FilterKeyEventCompletionHandler = std::function<void(const WebCore::CompositionResults&, InputMethodFilter::EventFakedForComposition)>;59 using FilterKeyEventCompletionHandler = Function<void(const WebCore::CompositionResults&, InputMethodFilter::EventFakedForComposition)>; 60 60 void filterKeyEvent(GdkEventKey*, FilterKeyEventCompletionHandler&& = nullptr); 61 61 void notifyFocusedIn();
Note: See TracChangeset
for help on using the changeset viewer.