diff options
author | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-13 21:14:39 +0000 |
---|---|---|
committer | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-13 21:14:39 +0000 |
commit | 3203631c5af1a3ff123c589c448fcb7fb4b4889d (patch) | |
tree | 83729c2fb05e7738b1906363f8d48c7eee6470cd /views/controls/textfield | |
parent | 7ec12d3a7c3ba1e4281bf83e11e81b138f391933 (diff) | |
download | chromium_src-3203631c5af1a3ff123c589c448fcb7fb4b4889d.zip chromium_src-3203631c5af1a3ff123c589c448fcb7fb4b4889d.tar.gz chromium_src-3203631c5af1a3ff123c589c448fcb7fb4b4889d.tar.bz2 |
Fix segfault. OnActivation should check GetWidget() first.
Remove dead code. This was overlooked when multiline support has been removed.
BUG=chromium-os:17509
TEST=none
Review URL: http://codereview.chromium.org/7356010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92417 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/textfield')
-rw-r--r-- | views/controls/textfield/native_textfield_gtk.cc | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/views/controls/textfield/native_textfield_gtk.cc b/views/controls/textfield/native_textfield_gtk.cc index d0d05b31..78fb2f9 100644 --- a/views/controls/textfield/native_textfield_gtk.cc +++ b/views/controls/textfield/native_textfield_gtk.cc @@ -313,10 +313,12 @@ void NativeTextfieldGtk::OnActivate(GtkWidget* native_widget) { if (controller) handled = controller->HandleKeyEvent(textfield_, views_key_event); - NativeWidgetGtk* widget = - static_cast<NativeWidgetGtk*>(GetWidget()->native_widget()); - if (!handled && widget) - handled = widget->HandleKeyboardEvent(views_key_event); + Widget* widget = GetWidget(); + if (!handled && widget) { + NativeWidgetGtk* native_widget = + static_cast<NativeWidgetGtk*>(widget->native_widget()); + handled = native_widget->HandleKeyboardEvent(views_key_event); + } // Stop signal emission if the key event is handled by us. if (handled) { @@ -397,16 +399,10 @@ void NativeTextfieldGtk::CreateNativeControl() { void NativeTextfieldGtk::NativeControlCreated(GtkWidget* widget) { NativeControlGtk::NativeControlCreated(widget); - if (GTK_IS_TEXT_VIEW(widget)) { - GtkTextBuffer* text_buffer = gtk_text_view_get_buffer( - GTK_TEXT_VIEW(widget)); - g_signal_connect(text_buffer, "changed", G_CALLBACK(OnChangedThunk), this); - } else { - g_signal_connect(widget, "changed", G_CALLBACK(OnChangedThunk), this); - // In order to properly trigger Accelerators bound to VKEY_RETURN, we need - // to send an event when the widget gets the activate signal. - g_signal_connect(widget, "activate", G_CALLBACK(OnActivateThunk), this); - } + g_signal_connect(widget, "changed", G_CALLBACK(OnChangedThunk), this); + // In order to properly trigger Accelerators bound to VKEY_RETURN, we need + // to send an event when the widget gets the activate signal. + g_signal_connect(widget, "activate", G_CALLBACK(OnActivateThunk), this); g_signal_connect(widget, "move-cursor", G_CALLBACK(OnMoveCursorThunk), this); g_signal_connect(widget, "button-press-event", G_CALLBACK(OnButtonPressEventThunk), this); |