From 209da8588ec7dc7ef79bcec262adca4bd212a91b Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 27 Feb 2003 20:47:06 +0000 Subject: [PATCH] Ideally, this would fix a crash. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19371 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/notebook.cpp | 5 ++++- src/gtk1/notebook.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 4439cbae46..78d7159a87 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -184,10 +184,13 @@ static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk if (!win->m_hasVMT) return FALSE; if (g_blockEventsOnDrag) return FALSE; - /* win is a control: tab can be propagated up */ + // win is a control: tab can be propagated up if ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab)) { int sel = win->GetSelection(); + if (sel == -1) + return TRUE; + wxGtkNotebookPage *nb_page = win->GetNotebookPage(sel); wxCHECK_MSG( nb_page, FALSE, _T("invalid selection in wxNotebook") ); diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index 4439cbae46..78d7159a87 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -184,10 +184,13 @@ static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk if (!win->m_hasVMT) return FALSE; if (g_blockEventsOnDrag) return FALSE; - /* win is a control: tab can be propagated up */ + // win is a control: tab can be propagated up if ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab)) { int sel = win->GetSelection(); + if (sel == -1) + return TRUE; + wxGtkNotebookPage *nb_page = win->GetNotebookPage(sel); wxCHECK_MSG( nb_page, FALSE, _T("invalid selection in wxNotebook") );